0

I have created a Jqgrid on a dropdown index change event..

$("#dropdown").on('change', function () {
$("#datagrid").jqGrid({
url: 'Default.aspx/callme'
...
});

This works fine for the 1st dropdown index change event. How to get the Jqgrid reloaded on every index change event of the dropdown. The Url seems to be not getting hit on the next index change event.

Gokul
  • 1
  • 1

2 Answers2

0

I think that one important the misunderstanding exists. The original page contains empty <table id="datagrid"></table>. After the call

$("#datagrid").jqGrid({
url: 'Default.aspx/callme'
...
});

it will be converted to relatively complex structure of grids on divs. So one can create the grid only once. At the second call jqGrid makes small test. Because the grid is already created it makes return almost immediately and do nothing.

If you want reload the data from the server then you should use $("#datagrid").trigger("reloadGrid");. If you need change then column header and other parts of grid then you can recreate the grid by usage $("#datagrid").jqGrid("GridUnload"); before $("#datagrid").jqGrid({...});. See the corresponding demo in the old answer.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Hi Oleg. I am using Jqgrid version "Guriddo jqGrid JS - v4.8.0 - 2015-03-20" and it seems this version doesn't support "GridUnload". link : http://guriddo.net/?p=123585. the site suggests to use "$.jgrid.gridUnload(‘#jqGridId’)" . however this too seems not to be working – Gokul Apr 01 '15 at 14:14
  • @Gokul: You have grid with `id="datagrid"`, then you should use `$.jgrid.gridUnload("#datagrid")`. I don't use Guriddo jqGrid JS or other commercial products. If `$.jgrid.gridUnload("#datagrid")` not work and you purchased the licence of Guriddo jqGrid JS then you can ask the question in [Guriddo forum](http://guriddo.net/?page_id=4). The [free jqGrid](https://github.com/free-jqgrid/jqGrid) is the fork of jqGrid which I develop (see [readme](https://github.com/free-jqgrid/jqGrid/blob/master/README.md) and [wiki](https://github.com/free-jqgrid/jqGrid/wiki)). It has `GridUnload`. – Oleg Apr 01 '15 at 14:59
0

1 > The method GridUnload – i.e

$(“#grid”).jqGrid(‘GridUnload’) 

does not have effect. Replace the old with the new one

$.jgrid.gridUnload(‘#jqGridId’);

where jqGridId is the id of the grid 2> The method GridDestroy – i.e

$(“#grid”).jqGrid(‘GridDestroy’) 

does not have effect. Replace the old with the new one

$.jgrid.gridDestroy(‘#jqGridId’); 

where jqGridId is the id of the grid 3> The method jqGridImport – i.e

$(“#grid”).jqGrid(‘jqGridImport’,options) 

does not have effect. Replace the old with the new one

$.jgrid.jqGridImport(‘#jqGridId’, options); 

where jqGridId is the id of the grid

Gokul
  • 1
  • 1