2014-11-17 27 views
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)當添加條件 「儀器類型」,並選擇 「選項」,它順利。

enter image description here

4)當添加其他條件,選擇的值被清零。

enter image description here

有誰知道爲什麼它是什麼?和什麼解決方案?非常感謝。

編輯:

我用dataInit功能以錯誤的方式,使用searchOptions.value代替,這個問題已經解決了,你可以參考另一篇文章:best way to dynamically populate dropdown options in jqgrid advanced searching

+0

你能否提供演示這個問題的演示?它可以是jsfiddle演示或任何其他,但它應該使用'jquery.jqGrid.src.js'而不是'jquery.jqGrid.min.js'。 'instrumentTypeDataInit'的代碼對我來說似乎很奇怪。什麼是'$ {categoryInstrumentTypeOptions}'?它是'

+0

@Oleg,我只是想動態地將選項追加到選擇控件。 $ {categoryInstrumentTypeOptions}是從服務器填充的選項字符串,然後在來自服務器的請求中設置。所以在ftl頁面中,我使用$ {}來獲取選項。 – Guanguan

+0

@ Oleg,我檢查了你回覆給我的另一篇文章,也許我以錯誤的方式使用了dataInt。會仔細檢查你的帖子。非常感謝。 – Guanguan

回答

0

我用過的dataInit函數以錯誤的方式使用searchOptions.value代替,問題已解決,你可以參考another pos t,Oleg給出了一個答案:

相關問題