JQGrid Expanding SubGrid on page load
Hi,
Recently guys, i faced problem while expanding the JQGrid SubGrid onLoad of the page.
Initially, i used the following code on gridComplete Event of JQGrid, Using the code given below, i am only able to expand grid but without data populated in subgrid.
gridComplete: function() {
var rowIds = $("#testTable").getDataIDs();
$.each(rowIds, function (index, rowId) {
$("#testTable").expandSubGridRow(rowId);
});
}
After trying different ways, and many efforts i came up with this solution and it worked for me.
Solution to above problem given below :
gridComplete: function() {
var timeOut = 50;
var rowIds = $("#testTable").getDataIDs();
$.each(rowIds, function (index, rowId) {
setTimeout(function() {
$("#testTable").expandSubGridRow(rowId);
}, timeOut);
timeOut = timeOut + 200;
});
}
It worked for me. Hope it help you too.
Thanks & regards,
Tarun Pareek
LinkedIn
Thanks so much , using your method its working perfectly !!
Thanks Tarun! Really, this was great help to me which I was looking for 4th level sub girds. It work perfectly for me.
Thanks, man! This was exactly what I was looking for =)
Thank you Tarun. This worked for me.
Originally, I was trying to use the subGridOption and setting expandOnLoad to true, but it would only load the first subgrid.
Using your method has worked perfectly.