我使用以下代码通过AJAX从服务器端加载数据,然后使用本地数据在jqGrid中显示它。我无法使用$.ajax({
url: 'dashboard/grid',
type: 'POST',
dataType: 'json',
data: {_token: $('#csrf_token').val(),from:from, to:to},
})
.done(function(data) {
gridData = data;
})
.fail(function() {
console.log("error");
});
var data = $grid = $("#dash_grid"), gridData;
$grid.jqGrid({
datatype: "local",
data: data,
search:true,
jsonReader: {cell:""},
rowNum: 10,
rowList: [5, 10, 20, 50],
sortname: 'id',
sortorder: 'asc',
viewrecords: true,
height: "100%",
caption: "Multiple search with local data",
colNames:['Date','Impressions', 'Revenue'],
colModel:[
{name:'date',index:'date', width:60, sorttype:"int"},
{name:'impressions',index:'impressions', editable: true, width:90},
{name:'revenue',index:'revenue', editable: true, width:100},
]
});
,因为它不支持分页。请在下面找到我的代码:
Table table = hbconnection.getTable(TableName.valueOf(DOC_TABLE_NAME));
没有显示任何错误但没有加载任何数据。如果我复制AJAX响应并在我设置数据的地方使用它,它就可以了。我怎样才能使这个工作?