Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqGrid with dynamic colModel?

Tags:

jquery

jqgrid

I have to create a data table simmiliar to the http://www.chartle.net/ have.

The most importang feature is :

  1. Row can be added/remove dynamically (done)
  2. Column can be added/remove dynamically (how can i do this ?)
  3. The changed colModel can be saved in database for feature modification ..

Is this possible ?

like image 448
Wildan Maulana Avatar asked Dec 29 '22 14:12

Wildan Maulana


2 Answers

Search getColProp and setColProp in their docs: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods

like image 147
Andrew DeLisa Avatar answered Jan 22 '23 19:01

Andrew DeLisa


The problem is, that you can't dynamically change the jQgrid ColModel. The two options I see are:

  1. Delete the whole grid and reload it with a new ColModel (if it can change entirely) using GridUnload:

    jQuery(selector).GridUnload(selector);

  2. Load all possible rows and show/hide the ones you need, e.g. by using the show hide columns plugin

For saving it dynamically it should be sufficient to store the configuration data for the grid in the database as JSON.

like image 30
Daff Avatar answered Jan 22 '23 19:01

Daff