ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: rgorantla on August 23, 2017, 06:36:16 pm

Title: Dynamic colModel from database
Post by: rgorantla on August 23, 2017, 06:36:16 pm
Instead of writing the colmodel - I am trying to make it dynamic i.e.e, to get the complete col-model from database.

ex: if there are new columns next year, i do not want to edit the JavaScript instead if i add a column in database with necessary properties - i should be able to get it with inline functions,etc...

Any way to do this?
Title: Re: Dynamic colModel from database
Post by: paramvir on August 24, 2017, 06:01:50 pm
that's possible by using data structures in your server side language corresponding  to array of objects ( colModel ) and serializing it to JSON string similar to the way JSON string for data is created in the examples.

When page is loaded, convert JSON string to colModel array and add it to grid initialization object.

However note that inline functions can't be part of JSON string.

So inline functions have to be attached after loading colModel.

function cellRenderer(ui){
}
colModel[0].render = cellRenderer