2
« on: January 07, 2014, 09:45:25 pm »
Hello,all.
As you know i'm a newbie.I'm learning pqgrid follow the tutorial,now I put following codes in my web page,but got a blank data view, please help me if you can,tons of thanks.
$(function () {
var obj = { width: 700, height: 400, title: "Grid From JSON data", flexHeight: true };
obj.colModel = [{ title: "Rank", width: 100, dataType: "integer", dataIndx: "rank" },
{ title: "Company", width: 200, dataType: "string", dataIndx: "company" },
{ title: "Revenues ($ millions)", width: 150, dataType: "float", align: "right", dataIndx: "revenues" },];
obj.dataModel = {
location: "remote",
sorting: "local",
dataType: "JSON",
method: "GET",
getUrl: function () {
return {url: "/tt.php"};
},
getData: function (dataJSON) {
var data = dataJSON.data;
return { data: dataJSON.data };
}
};
$("#grid_json").pqGrid(obj)
});
And the tt.php code are:
<?php
$json_arr = array('data'=>array(array('A','3','B'),array('C','3','D')));
$php_json = json_encode($json_arr);
echo $php_json;
?>