{"id":2784,"date":"2011-02-13T19:38:34","date_gmt":"2011-02-13T14:08:34","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=2784"},"modified":"2016-12-19T14:35:40","modified_gmt":"2016-12-19T09:05:40","slug":"jqgrid-expanding-subgrid-on-page-load","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/jqgrid-expanding-subgrid-on-page-load\/","title":{"rendered":"JQGrid Expanding SubGrid on page load"},"content":{"rendered":"<p>Hi,<br \/>\n&nbsp;<br \/>\nRecently guys, i faced problem while expanding the JQGrid SubGrid onLoad of the page.<br \/>\n&nbsp;<br \/>\nInitially, 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.<br \/>\n<\/p>\n<pre lang='groovy'>\r\ngridComplete: function() {\r\n                var rowIds = $(\"#testTable\").getDataIDs();\r\n                $.each(rowIds, function (index, rowId) {\r\n                        $(\"#testTable\").expandSubGridRow(rowId);                   \r\n                });\r\n            }\r\n<\/pre>\n<p>After trying different ways, and many efforts i came up with this <strong>solution<\/strong> and it worked for me.<br \/>\nSolution to above problem given below :<br \/>\n<\/p>\n<pre lang='groovy'>\r\ngridComplete: function() {\r\n                var timeOut = 50;\r\n                var rowIds = $(\"#testTable\").getDataIDs();\r\n                $.each(rowIds, function (index, rowId) {\r\n                    setTimeout(function() {\r\n                        $(\"#testTable\").expandSubGridRow(rowId);\r\n                    }, timeOut);\r\n                    timeOut = timeOut + 200;\r\n                });\r\n            }\r\n<\/pre>\n<p>It worked for me. Hope it help you too.<br \/>\n<\/p>\n<p>Thanks &#038; regards,<br \/>\nTarun Pareek<br \/>\nLinkedIn<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, &nbsp; Recently guys, i faced problem while expanding the JQGrid SubGrid onLoad of the page. &nbsp; 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 = $(&#8220;#testTable&#8221;).getDataIDs(); $.each(rowIds, function [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":11},"categories":[1],"tags":[96,55,517],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/2784"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=2784"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/2784\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=2784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=2784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=2784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}