griegs
griegs

Reputation: 22760

jqGrid filter not working

I have a column model like this;

{ name: 'AddressId', index: 'AddressId', key: true, width: 100, editable: false, editoptions: { size: 10 } },
{ name: 'Street Number', index: 'StreetNumber', width: 100, editable: true },

So the grid columns are;

AddressId, Street Number

When I filter on the AddressId, all works fine. When I enter a filter in "Street Number" the filtering comes up with zero results.

If I rename "Street Number" to "StreetNumber", the same as its index value, then the filtering works.

Is there a setting to change this?

Edit The same applies for Grouping. Works when the name is the same as the index but fails when it is not.

Upvotes: 2

Views: 3296

Answers (1)

Oleg
Oleg

Reputation: 221997

If you use datatype: "local" or some remote datatype ("xml" or "json") with loadonce: true then you have to have colModel with the same name and index property. I recommend don't specify any index property in the case and specify name property only. In the case the name value will be copied by jqGrid to index.

Second, one should not use name property which values contains special meta-characters (see here). name property will be used to build values of id attributes of some internal jqGrid constructions. So one have to escape spaces during every construction of selectors on the elements. Old versions didn't do this. More recent jqGrid versions escaped many meta-characters, but not the space. The current version (4.6) escapes spaces and one can in general use spaces in name, but it's strictly not recommended. I don't understand why you chosen name: 'Street Number'. One can use any names in colNames or in jsonmap, but why one could need to use name: 'Street Number'?

Upvotes: 3

Related Questions