I have a ASP.NET Core app, I want to load data to easyUI combogrid using ajax call. I do this way:
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);
But when I try to get the ptr to 'grid' I receive the error:
Uncaught TypeError: Cannot read property 'jQuery3110372840994670562' of undefined at U.get (jquery.min.js:3) at U.access (jquery.min.js:3) at Function.data (jquery.min.js:3) at grid (jquery.easyui.min.js:16058) at r.fn.init.$.fn.combogrid (jquery.easyui.min.js:16033) at Index:240
What is wrong? How to fix it and load data to the combogrid?
I took a hint from examples from EasyUI and your JSON must have "rows" array.
UPDATE:
Main point is to how to build Json object. I took as an example this link. So you need rows property that holds an array of Customers. See the code below.
WebApi Controller
Web page:
UPDATE 2:
Javascript (g25 variable is already set, so skip setting it again.):
Controller (it gives for test 4 or 8 items in the list):