Loading big datasets using JSON

Is it possible to load large datasets using JSON instead of XML? I saw the step-by-step uses XML. If so, where do the “total_count” and “pos” variables go inside the JSON? I have this format for example but it doesn’t work:

{ total_count:10000, pos: 0, rows:[ {‘row1’,…

Thanks.

Yes, it possible to use JSON format to load grid from big dataset. Please check JSON format example here docs.dhtmlx.com/doku.php?id=dhtm … at_details

Whenever I reach the end of the grid, no new data is loaded (no xhtml requests are sent either). It seems to not be reading my total_rows variable in the JSON. Why is this? Here is my initialization:

this.music_table = new dhtmlXGridObject("music_table");
this.music_table.setImagePath("/media/dhtmlxGrid/codebase/imgs/");
this.music_table.setHeader("Title,Artist,Album,Track,Plays,Genre,Time,Bitrate,Added");
this.music_table.setInitWidthsP("20,18,18,7,7,7,7,7,9");
this.music_table.setColSorting("server,server,server,server,server,server,server,server,server");
this.music_table.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro");
this.music_table.enableMultiselect(true);
this.music_table.init();
this.music_table.enableSmartRendering(true, 100);
this.music_table.setAwaitedRowHeight(25);
this.music_table.attachEvent("onXLE", grids.update_count);
this.music_table.load("/index.php/library/data/music_table", "json");

and my JSON starts like this and is properly formatted:

{'total_count':56222, 'pos': 0, rows:[{id:28786, data :['Them...

Any help? thanks

What is ‘grids.update_count’ doing?

Please check if you have attached dhtmlxgrid_json.js file to your page

That was it olga! But now I am getting this error:
uncaught exception: Error: r.childNodes[i] is undefined /media/dhtmlxGrid/codebase/ext/dhtmlxgrid_json.js
Line 1

Hi Olga,

what is ‘dhtmlxgrid_json.js’ doing, why it’s necessary? Documentation?
Reason: We’re transfer our datas in JSON.

mygrid.load(…, “json”); work without this script…

Regards, Carsten

Nevermind, I got it working. The reason you use _json.js is because I wanted dynamically loading table using JSON, instead of XML which is the default. Also, from above, @cm1310, grids.update_count is my own function.