jqgrid load from multiple urls
I have a page, that has jqgrid, it is fetching json from a url. I want to load data from multiple urls instead on one url, on the same grid.
How can开发者_运维百科 I achieve that. The reason is, I have to display data from different sources, the ids will be unique no-matter if its from which source.
Thanks
You can load the data which you want to place in the grid as array of items. From every source you will get an array. then you can concatinate the arrays for example with respect of jQuery.merge. You will receive the full array of items. At the end you create jqGrid with datatype: 'local'
and with the array of concatenated items as the value of the data parameter.
Did you try just calling addJSONData
multiple times?
var grid = $('#'+grid_id)[0];
grid.addJSONData(jsondata1);
grid.addJSONData(jsondata2);
grid.addJSONData(jsondata3);
精彩评论