Andrus
Andrus

Reputation: 27955

how to disable data retrieval on jqgrid load

jqgrid is used to show stock status from server. Data is retrieved in json format using controller in url parameter:

url: 'Grid/GetData'

Getting data (even 0 rows) takes some time. This causes noticeable delay on page load.

How to disable GetData controller call on initial jqgrid load? On initial load empty grid should appear, without rows.

Data should retrieved if such command is issued by user:

Upvotes: 1

Views: 3182

Answers (1)

Oleg
Oleg

Reputation: 222017

You should just use datatype: 'local' at the beginning. If you want to load the data from the server you should change datatype to 'json' with respect of setGridParam method and trigger reloadGrid.

In many scenarios like master/detailed grid I use the way. At the beginning the detailed grid has datatype: 'local'. If a row will be selected at the master grid I set datatype to 'json' for the detailed grid and reload it. In the postData of the detailed grid will be used the id of selected row from the master grid.

Upvotes: 3

Related Questions