0

onSearchEvent not fired on chosenBox when hitting ENTER

asked 2021-03-31 18:41:36 +0800

ziobleed gravatar image ziobleed
153 3

updated 2021-04-01 18:26:12 +0800

hi i implemented a chosenbox in zk 6.x

i intercept the event onSearch

like:

chosenbox.addEventListener("onSearch", new EventListener<InputEvent>() {
            @Override
            public void onEvent(InputEvent event) throws Exception {
                       ... add to model
                       ... add to selected items

It works when user click on the "plus" sign showed when the user inputs a new element in the chosen box. BUT it is not called when user click on key "ENTER" or write (ie) ";" (yes, i tried also to specify the separator=";" attribute in <chosenbox>

in zul the chosenbox is as:

<chosenbox id="chosenboxA" creatable="true" createMessage="{0}" emptyMessage="Specify a value" hflex = "1" />

best regards

UPDATE: discovered that the problem is related to the fact that i use a ListSubModel as model of the chosen box. I need the sub model to implement a search by "contains" and not "starts with" as explained here: forum.zkoss.org/question/100468/override-onsearching-in-chosenbox/

so i can't have the "contains" search and the ENTER key functionality at the same time.

I also tried to use 6.5.5 version of zk without success (problem persist)

ZB

delete flag offensive retag edit

Comments

( i cant answer, the zk foums says "answer must be > 10 chars", i'm using firefox) . t try to paste my answer here: ======== thanks for your ansewer

the problem seems related to the use of the ListSubModel in my project indeed i use ListSubModel.

Using ListSubModel the ENTER key doesnt work.

ziobleed ( 2021-04-01 17:36:44 +0800 )edit

.... i updated the fiddle. With my update the ENTER key doesn't work

ziobleed ( 2021-04-01 17:37:50 +0800 )edit

also i cant: upvote or post link

ziobleed ( 2021-04-01 17:38:56 +0800 )edit

to see my fiddle the link is https://zkfiddle.org/sample/2li6mct/2-chosenbox-separator-semicolon

ziobleed ( 2021-04-01 17:41:43 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-04-01 10:41:27 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2021-04-19 09:38:07 +0800

I can reproduce what you mentioned partially.

Issue1: separator=";" doesn't fire onSearch

The semicolon doesn't work which is a bug(https://tracker.zkoss.org/browse/ZK-4849) and it's fixed in the later version. Please use another character like ,

Issue2: Enter doesn't fire onSearch

I can't reproduce this with 6.5.8.1, please try https://zkfiddle.org/sample/2li6mct/1-chosenbox-separator-semicolon

Steps to reproduce:

  1. type aaa
  2. press enter

Current result

show a dialog with onSearch event string

Could you try the zkfiddle and give us feedback or modify it to reproduce your issue?

link publish delete flag offensive edit
0

answered 2021-04-06 09:55:32 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2021-04-06 09:55:47 +0800

Issue2: Enter doesn't fire onSearch

I found it's a known bug: https://tracker.zkoss.org/browse/ZK-3010 which is fixed at 8.0.1

I think the workaround is using ListModel.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2021-03-31 18:41:36 +0800

Seen: 11 times

Last updated: Apr 19 '21

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More