EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: getk on May 17, 2013, 05:21:39 AM



Title: Datagrid : json data containing "records" instead of "rows"
Post by: getk on May 17, 2013, 05:21:39 AM
Hi
We have a webservices which provides json data dynamically.
Unfortunately, the format is  
Code:
"total":3,"records": [
      {
        "employeeid": "1",
        "employee_name": "ABC"
      }
     ]

Essentially its "records" instead of "rows"  in the data meta-data. We are not able to change the data coming to us.
Can we parse the data to change "records" to "rows"  OR is there any-way to populate the data into a grid?


Title: Re: Datagrid : json data containing "records" instead of "rows"
Post by: stworthy on May 18, 2013, 12:21:27 AM
Try the 'loadFilter' to change data to what format the datagrid requires.
Code:
$('#dg').datagrid({
loadFilter: function(data){
return {
total: data.total,
rows: data.records
}
}
});


Title: Re: Datagrid : json data containing "records" instead of "rows"
Post by: getk on May 20, 2013, 07:59:01 AM
thanks mate