SelectorAgent does not work for combobox.
This is my selector:
"label[value='dropdownName'] + combobox > comboitem[label='itemLabel']"
and it correctly resolves the comboboxitem and calls ComboitemSelectAgentBuilder.select()
And this results in:
org.zkoss.zats.mimic.impl.EmulatorClient - HTTP response content: {"rs":[],"rid":1}
After debugging the server-side org.zkoss.zul.Combobox.service(org.zkoss.zk.au.AuRequest request, boolean everError)
I see that selecting a combobox item actually consist of two events:
- Events.ON_CHANGE
- Events.ON_SELECT
But SelectorAgent sends only the second and so main part of server-side code that is executed in on onChange is not executed.
This is how my FixedComboitemSelectAgentBuilder does it correctly:
@Override
public void select() {
String desktopId = target.getDesktop().getId();
Component combobox = getEventTarget();
String label = (String)(target.as(Comboitem.class).getLabel());// post onChange
InputEvent onChangeEvent = new InputEvent(Events.ON_CHANGE, (Component) target.getDelegatee(), label, null);
Map<String, Object> onChangeData = EventDataManager.getInstance().build(onChangeEvent);
((ClientCtrl) getClient()).postUpdate(desktopId, combobox.getUuid(), onChangeEvent.getName(), onChangeData, false);//post onSelect
Event onSelectEvent = new SelectEvent(Events.ON_SELECT, combobox, new HashSet<String>()add(target.getUuid());,(Component)target.getDelegatee());
Map<String, Object> onSelectData = EventDataManager.getInstance().build(onSelectEvent);
((ClientCtrl) getClient()).postUpdate(desktopId, combobox.getUuid(), onSelectEvent.getName(), onSelectData, false);// execute the events
((ClientCtrl) getClient()).flush(desktopId);
}