2017-04-18 30 views
0

我正在使用selectDialogTableselectdialog幫助輸入字段中的值。清除按鈕不會清除選擇對話框/表格選擇對話框中的搜索

但是,搜索後,如果單擊搜索字段旁邊的(X)按鈕,我的搜索字段不會被清除。

任何人都可以提供任何見解如何實現這一點?因爲我沒有看到任何與該領域有關的事件。

+1

你能告訴我們一些代碼嗎? – boroboris

+0

請用[mcve]更新您的問題。 – evolutionxbox

回答

0

您可以在事件search對其進行處理:

search : function(oControlEvent){ 

//Indicates if the user pressed the clear icon. 
if(oControlEvent.getParameters.clearButtonPressed) HERE WRITE YOUR CODE; 

} 
+0

對不起,這不工作,我只是試圖.. –

+0

而對於搜索,我使用的是一個oData模型。 –

+0

你在使用sap.m.SearchField嗎? – Jaro

0
<input type="text" id="myInput" > 
<span class="close" onclick="clearText()">X</span> 

function clearText(){ 
    document.getElementById('myInput').value= "" 
} 

剛剛嘗試這一點。希望它有效。

+0

請編輯您的答案,包括一些解釋。僅有代碼的答案對未來SO讀者的教育很少。您的回答是在低質量的審覈隊列中。 – mickmackusa