Configure JqGrid attributes of the properties of the Model class at runtime

Nov 7, 2012 at 9:29 AM

Hi,

First I would like to thank you for this great effort,

I have a question here, in my application I have the information of the columns attributes like "Searchable, Hidden, Sortable, ..." are saved in the database, How I could apply these attributes dynamically to the JqGrid.

 

 

Thanks

Ahmed

Coordinator
Nov 7, 2012 at 1:21 PM

There is no direct support for that scenario.

One way is to subclass the attributes in which you want to load values dynamically and override one of following:

  • The desired property
  • OnMetadataCreated method
  • InternalOnMetadataCreated method

But this is not possible for all attributes/properties (in case of OnMetadataCreated or InternalOnMetadataCreated you alse need to remember about calling the base implementation).

Another way is to try changing some attribues or create metadata classes at runtime with reflection.

There is also a scenario in which you can create JqGridConfiguration object on server side and use configuration import/export functionality (but you are loosing the "strongly typed" aspect here) - please check the example in sample project.

Dec 30, 2012 at 3:29 PM
TPeczek wrote:

One way is to subclass the attributes in which you want to load values dynamically and override one of following:

  • The desired property
  • OnMetadataCreated method
  • InternalOnMetadataCreated method

 

 

Would you please give an example how to do it.