Grid loads but no records are loaded, error pop-up

QuestionsGrid loads but no records are loaded, error pop-up
Oliver asked 2 months ago

bought the grid yesterday and installed it as indicated

when loading my demo page data is not loaded into the grid, error popup shows JSON data, tried it with various browsers, does not work

no data / html is echoed before the php part, cannot be the root cause of the error

3 Answers
Abu answered 2 months ago

Hello,

Please share your code for review.

Oliver answered 2 months ago
<?php
/**
 * PHP Grid Component
 *
 * @author Abu Ghufran <[email protected]> - http://www.phpgrid.org
 * @version 2.0.0
 * @license: see license.txt included in package
 */
include_once("../vocabulary-online.com/gridphp/config.php");
// include and create object
require 'conn_localhost.php';
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
// Database config file to be passed in phpgrid constructor
$db_conf = array(
    "type"        => PHPGRID_DBTYPE,
    "server"   => PHPGRID_DBHOST,
    "user"        => PHPGRID_DBUSER,
    "password"     => PHPGRID_DBPASS,
    "database"     => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);
$grid["caption"] = "Sample Grid";
$g->set_options($grid);
$g->table = "sys_languages";
$out = $g->render("list10");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen" href="gridphp/lib/js/themes/redmond/jquery-ui.custom.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="gridphp/lib/js/jqgrid/css/ui.jqgrid.css" />
    <script src="gridphp/lib/js/jquery.min.js" type="text/javascript"></script>
    <script src="gridphp/lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
    <script src="gridphp/lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
    <script src="gridphp/lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
</head>
<body>
<div>
    <?php echo $out ?>
</div>
</body>
</html>
Abu answered 2 months ago

It seems like there is some white space in one of the included files.

e.g. Check ‘conn_localhost.php’
There are usually 2 reasons for this.

1) Blank space character at start of grid file OR before render() function (new line etc)
White spaces can be removed by checking top and end of all included files.
2) Invisible BOM character at start of file
To remove invisible BOM character, i would recommend Notepad++ -> Open file -> Encoding menu -> Encode UTF without BOM

Your Answer

5 + 18 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?