0

I want to remove jqGrid and reDisplay it with another data.
is it correct to follow this:

 $("div#disp").empty().append("<table id='display'>");
 $("table#display").jqGrid({...});

when div#disp surronds table#display

Joel
  • 7,401
  • 4
  • 52
  • 58
shevski
  • 1,012
  • 1
  • 10
  • 32

1 Answers1

2

There are many ways to do what you need. The best way is depend on the exact requirements.

If you just want to change the grid contain without adding or removing a grid column you can just change some grid parameters, postData and probably url and then call $('#list').trigger('reloadGrid').

If you need to show really another grid on the same place the usage of GridUnload method can solve the problem. See here for more information and the demo.

If you need some optimization in removing of grid contain you can do what described here.

jqgrid delete all rows inside grid

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • I need to add columns in dynamic way, this is the best I've got thanks for pointing to the custom methods – shevski May 18 '11 at 11:24
  • @shevski: If you add column dynamically you should know one more way described [here](http://stackoverflow.com/questions/5383847/is-it-possible-to-modify-the-colmodel-after-data-has-loaded-with-jqgrid/5408195#5408195). – Oleg May 18 '11 at 11:30