在 jqgrid 高级搜索中,在我添加新条件后,下拉列表中选择的值被清除。
下面详细介绍供大家参考。
1)在jqgrid列模型中
{name:'instrumentType',
index:'instrumentType',
searchoptions:{
dataInit:instrumentTypeDataInit,
sopt: ['eq','ne','nu','nn','in','ni']},
align:"left",
stype:'select'},
2) instrumentTypeDataInit 的 javascripts 函数
instrumentTypeDataInit=function(el){
var categoryInstrumentTypeOptions = "${categoryInstrumentTypeOptions}";
$(el).append(categoryInstrumentTypeOptions);
}
3)当添加条件“仪器类型”,并选择“选项”时,一切顺利。
4) 添加其他条件时,选择的值被清除。
有谁知道这是为什么?解决方案是什么?多谢。
编辑:
我以错误的方式使用了dataInit函数,改为使用searchOptions.value,问题已解决,您可以参考另一篇文章:在jqgrid高级搜索中动态填充下拉选项的最佳方法