Reputation: 3169
This post covers what I need to do: Use of local datatype to prevent grid load; however when I do this at $(document).ready(), the grid loads itself but the data then displays blank rows. (I notice that the number of rows returned is correct for the ajax call).
I've also tried specifying the model's BeforeAjaxRequest to set datatype:'local', but this doesn't happen in time to prevent the call either.
How can I stop the first grid load of a jqGrid declared in an MVC view?
Upvotes: 2
Views: 1533
Reputation: 3169
Trirand has modified jqGrid so that if you wire up a BeforeAjaxRequest function and have that function return false, the request is not sent.
This resolves the problem nicely.
Upvotes: 3
Reputation: 221997
If I understand you correct you want that the empty grid will not displayed at the page load. You can do this in at leas two ways:
<table>
and the optional pager <div>
elements. So you can call $("#list").jqGrid({/*jqGrid parameters*/});
only if you want display the grid (at least as empty).<table>
and the optional pager <div>
elements in another container div which are hidden (<div id="mycontainer" style="display:none">...</div>
) and make it visible ($("#mycontainer").show()
) only if you want to show the grid.Upvotes: 0