0

onDoubleClick event isn't received, wireEventListeners is called.

asked 2014-08-26 13:23:42 +0800

adamian gravatar image adamian
15 4

Hello everyone,

After I'm replacing the grid model (grid.setModel(newModel)) I'm calling wireEventListeners(grid, this) but I don't seem to receive the new events. I've tried to debug it and it does seem to find the components in the wireEventListereners function, but after that I've got lost.

  1. Open zkfiddle zkfiddle.org/direct/1r52snl/4/v7.0.2-testGrid?run=1l3ur4p
  2. Double click row ("aaaa", "bbb" or "ccc")
  3. Click button "Change model"
  4. Double click one of the new rows ("111", "222", "333")
  5. I would have expected a new message box.

What am I not doing right?

Thanks and best regards, Andrei

@Listen("onClick = #changeModel")
public void changeModel(Event e) throws InterruptedException {
    myGrid.setModel(new ListModelList<String>(new String[]{"111", "222", "3333"}));
    Selectors.wireEventListeners(myGrid, this);
    //Selectors.wireEventListeners(myWindow, this);
}
delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-08-27 08:08:23 +0800

Darksu gravatar image Darksu
1991 1 4

Hello adamian,

When i want to add a event listener, i use the following code sample:

//You can set here your component name, and the event type
componentName.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
    @Override
    public void onEvent(Event event) throws Exception {
        //DO SOMETHING
    }
});

*Usually i also implement it with a custom RowRenderer.

Best Regards,

Darksu

link publish delete flag offensive edit

Comments

Won't work: If I add a new event listener (different event type) to an existent row, the browser is notified about the new listener. But if I remove all elements from the ListModelList and add a new row with an event, the information about the event is not passed to the browser.

adamian ( 2014-08-27 08:44:39 +0800 )edit

In second case the browser receives "['zul.grid.Row','wKVV161',{loaded:true,index:0}..." instead of "['zul.grid.Row','wKVVs91',{$onDoubleClick:true,loaded:true,index:0}..."

adamian ( 2014-08-27 08:45:29 +0800 )edit
0

answered 2014-08-27 10:25:51 +0800

adamian gravatar image adamian
15 4

Dear me,

You have to render the rows (by calling for example myGrid.renderAll()) before calling Selectors.wireEventListeners().

The grid will render the new rows and will replace them with other rows created by the RowRenderer, so the event listeners will be lost along with the not yet rendered rows objects.

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
2 followers

RSS

Stats

Asked: 2014-08-26 13:23:42 +0800

Seen: 13 times

Last updated: Aug 27 '14

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