0
在jqGrid的高級搜索,之後我添加新的標準,在下拉列表中選擇的值被清除。選擇的值在下拉列表中清除的jqGrid中添加新的標準後,高級搜索
以下詳細供您參考。
1)中的jqGrid列模型
{name:'instrumentType',
index:'instrumentType',
searchoptions:{
dataInit:instrumentTypeDataInit,
sopt: ['eq','ne','nu','nn','in','ni']},
align:"left",
stype:'select'},
2)的JavaScript功能instrumentTypeDataInit
instrumentTypeDataInit=function(el){
var categoryInstrumentTypeOptions = "${categoryInstrumentTypeOptions}";
$(el).append(categoryInstrumentTypeOptions);
}
3)當添加條件 「儀器類型」,並選擇 「選項」,它順利。
4)當添加其他條件,選擇的值被清零。
有誰知道爲什麼它是什麼?和什麼解決方案?非常感謝。
編輯:
我用dataInit功能以錯誤的方式,使用searchOptions.value代替,這個問題已經解決了,你可以參考另一篇文章:best way to dynamically populate dropdown options in jqgrid advanced searching
你能否提供演示這個問題的演示?它可以是jsfiddle演示或任何其他,但它應該使用'jquery.jqGrid.src.js'而不是'jquery.jqGrid.min.js'。 'instrumentTypeDataInit'的代碼對我來說似乎很奇怪。什麼是'$ {categoryInstrumentTypeOptions}'?它是'
@Oleg,我只是想動態地將選項追加到選擇控件。 $ {categoryInstrumentTypeOptions}是從服務器填充的選項字符串,然後在來自服務器的請求中設置。所以在ftl頁面中,我使用$ {}來獲取選項。 – Guanguan
@ Oleg,我檢查了你回覆給我的另一篇文章,也許我以錯誤的方式使用了dataInt。會仔細檢查你的帖子。非常感謝。 – Guanguan