你好我是JQGrid和java的新手。我正在尝试将数据填充到我的JQGrid。如果我在本地添加数据,它工作正常。但是,如果我尝试访问保存到文件的json数据,它将无法正常工作。我尝试了所有其他问题,但没有帮助。
var mydata = [
{"Path":"\\template\\604.rtf","SNo":"1","TemplateName":"604.rtf"},
{"Path":"\\template\\Template_1.rtf","SNo":"2","TemplateName":"Template_1.rtf"},
{"Path":"\\template\\Template_2.rtf","SNo":"3","TemplateName":"Template_2.rtf"}
];
jQuery(document).ready(function() {
$("#templatesGrid").jqGrid({
url:'gsonfile.json',
datatype: 'json',
type: 'GET',
height: 250,
colNames:['SNo','Template Name','Path'],
colModel:[
{name:'SNo',index:'SNo', width:50,sortable:false},
{name:'TemplateName',index:'TemplateName', width:350,sortable:false},
{name:'Path',index:'Path', width:550,sortable:false}
],
multiselect: false,
paging: true,
pager : '#pager',
rowNum:10,
rowList:[10,20,30],
pager: $("#page"),
loadonce:true,
caption: "Templates"
}).navGrid('#page',{edit:false,add:false,del:false});
});
以下是我的json文件数据
[{"Path":"\\\\template\\604.rtf","SNo":"1","TemplateName":"604.rtf"},
{"Path":"\\\\template\\SampleTemplate_1.rtf","SNo":"2","TemplateName":"Template_1.rtf"},
{"Path":"\\\\template\\SampleTemplate_2.rtf","SNo":"3","TemplateName":"Template_2.rtf"}]
我错过了什么吗?