-
Bug
-
Resolution: Fixed
-
Normal
-
6.0.0
I wrote some code to listen onFocus/onBlur event from Selectbox, but the listener hasn't been notified.
see following example:
<zk> <vbox> <hbox> <label value="get focus: " /> <label id="current" /> </hbox> <hbox> <label value="lost focus: " /> <label id="lost" /> </hbox> <vbox id="comps"> <zscript><![CDATA[ ListModel lm = new ListModelArray(new String[]{ "item" }); ]]> </zscript> <selectbox id="selectbox" model="${lm}" onFocus="current.value = self.id" onBlur="lost.value = self.id" /> <checkbox id="checkbox" label="checkbox" onFocus="current.value = self.id" onBlur="lost.value = self.id" /> </vbox> </vbox> </zk>
I traced Selectbox.java and Selectbox has listened onFocus/onBlur event:
static {
addClientEvent(Selectbox.class, Events.ON_SELECT, CE_DUPLICATE_IGNORE
| CE_IMPORTANT);
addClientEvent(Selectbox.class, Events.ON_FOCUS, CE_DUPLICATE_IGNORE);
addClientEvent(Selectbox.class, Events.ON_BLUR, CE_DUPLICATE_IGNORE);
}
But the service(AuRequest, boolean) method doesn't seems handle onFocus/onBlur event and invoke super.service():
public void service(org.zkoss.zk.au.AuRequest request, boolean everError) { final String cmd = request.getCommand(); if (cmd.equals(Events.ON_SELECT)) { _jsel = ((Integer) request.getData().get("")).intValue(); final Integer index = ((Integer)request.getData().get("")); final Set<Object> selObjs = new LinkedHashSet<Object>(); if (index >= 0) selObjs.add(_model.getElementAt(index)); if (_model != null) getSelectableModel().setSelection(selObjs);; Events.postEvent(new SelectEvent(Events.ON_SELECT, this, null, selObjs, null, index, 0)); } }
- relates to
-
ZK-4838 searchbox and cascader support onFocus and onBlur
- Closed