I want to change my grid's colmodel dynamiclly and I did lots of search but non of the question thread answered me. I need to pivot a select in sql so after I execute my query I find out names and count of my grid's columns.
In other posts I find the way of changing the colmodel but I don`t know when and where I must do it. It is not possible to execute query two time becuase It may changed in result and decrease performance.
One can use
beforeProcessing
callback to make many modifications incolModel
dynamically. One can't add/remove columns and one can't modifyname
property, but the most other changes are allowed. I would recommend you to usesetColProp
method to make the modification. One can usesetLabel
to modify column headers. The answer, this one and the another one provides corresponding examples.I am working now on
addColumn
/removeColumn
column methods which will allow to modifycolModel
more deep. You can find the current beta version ofaddColumn
with the corresponding demos on github.