Why parse is need index column?


#1

hello

i using dhtmlx 5.1 Version and used ajax api

i want to database to parse(json) key, value parse

example source
as is :
function search() {
$.ajax({ type:“POST”
,url :“load.do”
,data:{select:“TS0200.TS0200:Grid”}
,success:function(data, status, xhr) {
layOut.cells(‘b’).progressOff();
grid.clearAll();
if(data.status==“SUCCESS”){
grid.parse(data.list,“json”);
grid.setSelectedRow(0);
document.getElementById(“message”).innerHTML = grid.getRowsNum()+“rows selected”;
}else{
dhtmlx.alert({title:“selected fail!”,type:“alert-error”,text:data.message});
}
}
,dataType:“json”
,async:true
,error:function(x,s,t){layOut.cells(‘b’).progressOff(); httpError(x,s,t);}
});
}

  • query
    select AA, BB, CC, DD from dual;

but, my view page want to index [BB, AA, CC, DD]
Is the only way to change the query order?

please help me
thanks you.


#2

Here is the requesting format of the json in this case:
https://docs.dhtmlx.com/grid__data_formats.html#jsonformat
It has no connection with your column ids.
In your case you should try to use the "js " type of data instead of “json”. In this case a native JSON will be used as the source of data:

{
    "total_count":50000, "pos":0, "data":[
        {   
            "col1": "A Time to Kill",
            "col2": "John Grisham",
            "col3": "100"
        },
        { 
            "col1": "Blood and Smoke",
            "col2": "Stephen King",
            "col3": "1000"
        },
        { 
            "col1": "The Rainmaker",
            "col2": "John Grisham",
            "col3": "-200"
        }
    ]
};