EasyUI Forum
May 04, 2024, 09:31:31 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Combogrid consume API  (Read 3131 times)
pams
Newbie
*
Posts: 4


View Profile Email
« on: September 01, 2019, 07:15:21 PM »

Hi...

I have json data from other developer like this:
{
    "status": {
        "error": false,
        "message": "",
        "code": 200
    },
    "data": [
        {
            "RowNumber": "1",
            "id": "01",
            "kode": "101",
            "nama": "HEAD OFFICE",
            "idregion": {
                "RowNumber": "1",
                "id": "11111",
                "kode": "1",
                "nama": "SOME CITY"
            },
            "kodeRegion": "1",
            "namaRegion": "SOME CITY"
        },{
            "RowNumber": "22",
            "id": "22",
            "kode": "322",
            "nama": "SAMPLE BRANCH",
            "idregion": {
                "RowNumber": "1",
                "id": "11113",
                "kode": "3",
                "nama": "SAMPLE REGION"
            },
            "kodeRegion": "3",
            "namaRegion": "SAMPLE REGION"
        }
    ],
    "meta": {
        "more": false,
        "cursor": {
            "count_rec": 22,
            "count_data": 22,
            "count_page": 1,
            "curr_page": 1,
            "next_page": 0
        }
    }
}

as you can see, there's no "rows" element in the json data.

how can i populate that json to combogrid..?

thanks a lot...
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: September 03, 2019, 02:23:24 AM »

Define the 'loadFilter' function to convert the original data to the desired data format.
Code:
$('#cg').combogrid({
data: data,
loadFilter: function(data){
return data.data;
}
})
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!