How to programmatic trigger an onSelect$myListBox Event

asked 2018-10-19 01:29:19 +0800

bztom35 gravatar image bztom35
103 4

updated 2018-10-19 12:43:09 +0800

cor3000 gravatar image cor3000
6032 2 7
ZK Team

I want to select the first item on rsListBox before doBeforeComposeChildren() method.

How to select the first item on onSelect$rsListBox below programmatically?

public void onSelect$rsListBox(Event evt) {
    this.fcst_sensor_id  = (String)rsListBox.getSelectedItem().getValue();
    String header = (String)rsListBox.getSelectedItem().getLabel();
    System.out.println("Selected  id:" + this.fcst_sensor_id);
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-19 13:01:09 +0800

cor3000 gravatar image cor3000
6032 2 7
ZK Team

updated 2018-10-19 14:13:00 +0800

Before doBeforeComposeChildren ... there's nothing rendered yet so you can't select a listitem at this point.

onSelect$rsListBox is an event listener which also will only trigger if a component receives an event. If not yet rendered there won't be an event.

Said that, the think you might have to look into is model-based rendering (either by template or item renderer). i.e. you populate the data and selected object(s) before the rendering happens.

here an example http://zkfiddle.org/sample/3ajgh1d/1-listbox-with-model-and-initial-selection

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




Asked: 2018-10-19 01:29:19 +0800

Seen: 6 times

Last updated: Oct 19 '18

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