
Untitled
By: a guest on
Aug 8th, 2012 | syntax:
None | size: 1.08 KB | hits: 8 | expires: Never
jqgrid, getting data to display
jQuery("#list2").jqGrid({
url: 'AJAX/get.php?request=allReviews',
datatype: "json",
colNames: ['App', 'Submitted By', 'Date', 'Read'],
colModel:[
{name:'App',index:'app', width:75},
{name:'Submitted',index:'submittedDate', width:90},
{name:'Date',index:'name', width:100},
{name:'Read',index:'read', width:80, align:"right"},
],
rowNum:20,
autowidth: true,
rowList:[10,20,30],
pager: jQuery('#pager1'),
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"Reviews",
height: "350px"
}).navGrid('#pager',{edit:false,add:false,del:false});
if (isset($_GET["request"]))
{
switch($predefinedRequest)
{
case 'allReviews':
$data = new review;
$data->app = "test";
$data->ID = 1;
$data->name = "test";
$data->submittedDate = "test";
echo json_encode($data);
break;
}
}
class review
{
public $ID;
public $app;
public $submittedDate;
public $name;
public $read;
}