我有一个ASP.NET Core应用程序,我想使用ajax调用将数据加载到easyUI combogrid。我这样做:
var jsonData = [];
populateGrid();// Here is ajax call, jsonData array is populated
var g23=$('#ipCC').combogrid({
panelWidth: 450,
value: '006',
idField: 'customerID',
textField: 'fullName',
source:jsonData,
columns: [[
{field: 'customerID', title: 'customerID', width: 60 },
{field: 'fullName', title: 'fullName', width: 100 }
]]
});
var g25 = $('#ipCC').combogrid('grid');//<-----------------error
g25.datagrid('loadData', jsonData);
但是当我尝试将ptr设置为'grid'时,会收到错误消息:
未捕获的TypeError:无法读取属性'jQuery3110372840994670562'未定义在U.get(jquery.min.js:3)在U.access(jquery.min.js:3)在Function.data(jquery.min.js:3)在网格上(jquery.easyui.min.js:16058)在r.fn.init。$。fn.combogrid(jquery.easyui.min.js:16033)在索引:240
怎么了?如何修复它并将数据加载到combogrid?
<input id="cc" name="dept" value="01">
<script type="text/javascript">
var jsonData = {"rows":[
{"customerID":"ID1","fullName":"John XYZ"},
{"customerID":"ID2","fullName":"John ABC"},
{"customerID":"ID3","fullName":"John DEF"},
{"customerID":"ID4","fullName":"John GHJ"},
{"customerID":"ID5","fullName":"John KLM"},
{"customerID":"ID6","fullName":"John PQR"},
{"customerID":"ID7","fullName":"John STU"},
{"customerID":"006","fullName":"John STU 2"}
]};
//populateGrid();// Here is ajax call, jsonData array is populated
var g23 = $('#cc').combogrid({
panelWidth:450,
value:'006',
idField:'customerID',
textField:'fullName',
source: jsonData,
columns: [[
{field: 'customerID', title: 'customerID', width: 60 },
{field: 'fullName', title: 'fullName', width: 100 }
]],
});
var g25 = $('#cc').combogrid('grid'); //<-----------------NO error
g25.datagrid('loadData', jsonData);
</script>
我从EasyUI的示例中获取了hint,并且您的JSON必须具有“行”数组。