We use the jqGrid navigator reload button on a grid with loadonce set to true.
The reload button currently does NOT go back to the server to get the data – how can we get the reload to go to the server to get the latest data?
I believe we can use the beforeRefresh callback to set the grid data to json instead of local but I’m not clear how to even configure the beforeRefresh method – I don’t really understand the docs.
You are not the only person which has the problem. I answerd to the same question before. To reload the grid content from the server you should reset the
datatypeparameter to original value “json” or “xml” and then refresh the grid. For exampleUPDATED: To call the line inside of beforeRefresh event handler you can do following
I modified an example from am old question. Here if you click on the refresh button you can see live how the code work.
UPDATED 2: Free jqGrid supports some new options.
reloadGridevent supportsfromServer: trueparameter which can be used to force reloading of data from the server andnavGridsupportsreloadGridOptionsoption which can be used to specify the options ofreloadGridused on click on Refresh button. So the above code could beBy the way one can use
navOptionsoption of jqGrid to specify default options ofnavGrid(see the wiki article). It allows to write the code something like