ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: cijojohn on April 15, 2017, 08:52:21 am
-
Hi Team,
We are facing issue with Select box sorting and filter.
The way we are populating our drop down options is in the form... array of associative value label pairs e.g., [ { 'CB01': 'Mark' }, { 'CB02': 'Robert' }, ... ].
So when i sort with text box as a filter type the column is getting sort on base of value. i.e CB01 & CB02. But we want to sort our column data on basis of label. i.e Mark And Robert.
Could you please share a jsFiddle for the same.
-
That's a good question.
You need to store labels ('Mark', 'Robert') in that column while values ('CB01', 'CB02') in a hidden column with help of editor.mapIndices option. and change the options from associative value label pairs to {key1: label, key2: value} format.
There is already a good example here, check the ShipVia column: https://paramquery.com/pro/demos/editing_custom
{ dataIndx: 'ShipViaId', hidden: true }, //hidden column to store ShipVia Id.
{ title: "Shipping Via", dataIndx: "ShipVia", width: 110,
editor: {
type: 'select',
init: function (ui) {
ui.$cell.find("select").pqSelect();
},
valueIndx: "value",
labelIndx: "text",
mapIndices: {"text": "ShipVia", "value": "ShipViaId"},
options: [
{ "value": "", "text": "" },
{ "value": "SE", "text": "Speedy Express" },
{ "value": "UP", "text": "United Package" },
{ "value": "FS", "text": "Federal Shipping" }
]
}
},