我在下面使用json数据进行flexigrid,但它不起作用。
json.txt
{'page':1,'total':1,'rows':[{'id':1,'cell':['S1','H','Jerry']},{'id ':2,'cell':['S1','H','Terry']}]}
的javascript:
$('#idefectreport').flexigrid({
url: 'json.txt',
dataType: 'JSON',
colModel: [
{display: 'DefectID', name : 'id', width : 40, sortable : true, align: 'center'},
{display: 'Priority', name : 'priority', width : 180, sortable : true, align: 'center'},
{display: 'SupportID', name : 'supportid', width : 120, sortable : true, align: 'center'}
],
buttons : [
{name: 'Add', bclass: 'add'},
{name: 'Delete', bclass: 'delete'},
{separator: true}
],
searchitems : [
{display: 'DefectID', name : 'id'},
{display: 'Priority', name : 'priority', isdefault: true}
],
height:'auto',
sortname: "id",
sortorder: "asc",
title: 'Defect Report',
usepager: true,
useRp: true,
rp: 10,
showTableToggleBtn: true
});
代码有什么问题?谢谢!
答案 0 :(得分:1)
你的json格式不正确,单引号应该是字符串的双引号