开发者

OnKeyup in input field tied to partial refresh not working on last backspace

开发者 https://www.devze.com 2023-02-15 00:10 出处:网络
I have written an web page in XPages. I have an input field that fires the onkeyup event when a value changes. In the onkeyevent I fire a partial refresh of a div that contains a view of data. I subse

I have written an web page in XPages. I have an input field that fires the onkeyup event when a value changes. In the onkeyevent I fire a partial refresh of a div that contains a view of data. I subset the data using what the user types. So, for example, the list may begin with

Alan Brad Bryan Bill Chad

If the user types "B" then we are left with only the middle three names, if they then add an r for "Br" we are left with only Brad and Bryan and so on.

If the user backspaces then the process is reversed.

It all works perfectly but for one problem. Wh开发者_C百科en the user backspaces such that the input field is blank the view should revert back to all names, but it doesn't, it stays just the same as when it had 1 letter. If I backspace AGAIN, THEN the view gets all values.

I have struggled with this for hour with no success and would really appreciate any help.

Thanks,

Bryan


Are you using a viewScope variable to control the view content?

I have a Filter Tool for my views where when typing (onKeyUp) the data is written to viewScope.query. the partial refresh is set on the viewPanel

The data of the view I have set the "Search in view results:" to viewScope.query

Try adding a check if viewScope.query is not null then send back the viewScope.query

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号