How to set key column on model?

Feb 15, 2013 at 3:19 PM
How you can set KEY column on model? My question is because i was editing a row on grid that is gruped by a a field of the model, and automatic set ID to grouped field column and i want to set another column, any idea?
Regards
Coordinator
Feb 15, 2013 at 6:14 PM
The best way to provide row id for jqGrid is to pass proper value as the first parameter of JqGridRecord<TModel> constructor.

As an alternative you can set the following properties of JsonReader:
RepeatItems = false;
RecordId = "<Row id column name>";
This can be done globaly on JqGridResponse.JsonReader or localy on specific JqGridHelper and JqGridResponse instances.

The third option is to put JqGridColumnMappingAttribute on the property of your model and set it's Key property to true (but this one will only work if there is no id from the server, if you are sending some dummy value in the standard row id field from JqGridRecord this attribute will not cause to override it).