I am attempting to load two jqgrids onto one page with ajax. My problem is that the first grid loads quite speedily and the second takes several seconds. Paging through the second also takes a a few seconds.
Here is the structure of my code. This is the jquery that calls the ajax with the table elements on the page.
$(document).on("click", "#loadTables", function(){
$.post("./ajax/page_with_tables.php", {}, function(data){
$(body).html(data);
build_first_grid();
window.setTimeout(function(){
build_second_grid();
}, 10);
});
});
Both grids load, and functionally work as expected, but the second grid is painfully slow. Both grids have approximately 3000 rows. The "build_*_grid()" functions are simply the calls to jqgrid to build the grid, nothing special. Both are using their own ajax calls that returns XML.
The timeout function is there because if both are loading at the exact same time there is an issue with the graphics. A short timeout solves the problem.
Here is the html being sent to the browser from page_with_tables.php
<div id="tableOne"><table id="tableOneData"><tr><td></td></tr></table><div id="tableOnePager"></div></div>
<div id="tableTwo"><table id="tableTwoData"><tr><td></td></tr></table><div id="tableTwoPager"></div></div>
I have searched and asked, but I can not seem to find the issue. Help is much appreciated.