我遇到的是 jQGrid 按其值对选择选项进行排序,而我找不到使其按标签排序的方法。
选项在本地加载:
var cities = {
"15604":"Akashi",
"7538":"lompolo",
"13488":"Akersloot",
"15516":"Akita",
"17301":"Akizuki",
"15848":"Akola",
"11415":"Akron",
"15224":"Akron",
"7458":"Akrotiri",
"10783":"Aksaray",
"15127":"Aksu",
"9563":"Aktobe"
};
但选项显示如下:
<option role="option" value="7458">Akrotiri</option>
<option role="option" value="7538">lompolo</option>
<option role="option" value="9563">Aktobe</option>
<option role="option" value="10783">Aksaray</option>
<option role="option" value="11415">Akron</option>
<option role="option" value="13488">Akersloot</option>
<option role="option" value="15127">Aksu</option>
<option role="option" value="15224">Akron</option>
<option role="option" value="15516">Akita</option>
<option role="option" value="15604">Akashi</option>
<option role="option" value="15848">Akola</option>
<option role="option" value="17301">Akizuki</option>
这是我使用它的部分:
//other colModels,
{
"name":"city_id",
"index":"city",
"width":"100",
"editable":true,
"align":"center",
"edittype":"select",
"formatter":"select",
"editoptions":{"value":cities},
"stype":"select",
"searchoptions":{
"sopt":["eq","ne"],
"value":cities}
}
//other colModels
添加或编辑记录时,如何使选择选项按其标签而不是按其值排序?