I have a select field as one of the columns in my datatable and I was wondering if the options can be sorted based on id
For e.g. the following options are constructed on the server side:
var typeOptions = [
{
"id": "1", "value": "Type_1"
},
{
"id": "2", "value": "Type_2"
},
{
"id": "3", "value": "Type_3"
},
{
"id": "4", "value": "Type_4"
},
{
"id": "5", "value": "Type_5"
},
{
"id": "6", "value": "Type_6"
},
{
"id": "7", "value": "Type_7"
},
{
"id": "8", "value": "Type_8"
},
{
"id": "9", "value": "Type_9"
}
];
and the column is declared as following:
{
id: "Type",
header: "<span title='Type'>Type</span>",
editor: "select", options: typeOptions, width: 100
}
Now I would like to sort these values in the dropdown based on id’s
Is that possible.
Note: These options are dynamically constructed on the server side, I am just posting some dummy values for the sake of understanding.
I would appreciate any help on this. Thanks.