EasyUI Forum
December 20, 2025, 12:37:50 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: json data for datagrid -- can I change the word total & rows  (Read 8636 times)
Aod47
Jr. Member
**
Posts: 85


View Profile
« on: July 30, 2016, 03:25:45 AM »

Hello,

Because sometimes. I got json data from cross server that not use total, rows for datagrid paging eg. results_count for total,
and results for rows the example file structure below.

{
  "code" : 1,
  "results_count": 10,
  "results" : [
      "col1" : 001,
      "col2" : xxxx

.................

So, how do I use json data directly with easyui datagrid?

Thank you for helping



Logged
jarry
Administrator
Hero Member
*****
Posts: 2305


View Profile Email
« Reply #1 on: July 30, 2016, 05:21:55 PM »

Please use 'loadFilter' to convert the original data to the desired data format.
Code:
$('#dg').datagrid({
  loadFilter: function(data){
    return {
      total: data.results_count,
      rows: data.results
    };
  }
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!