PDA

View Full Version : MultiSelect dblclick event handler



janhov
27 Sep 2011, 3:56 AM
There is an unanswered thread on this in the 3.x forums. Posting on 4.x as the multiselect component is listed in the 4.0.2a samples:
http://dev.sencha.com/deploy/ext-4.0.2a/examples/multiselect/multiselect-demo.html
(http://dev.sencha.com/deploy/ext-4.0.2a/examples/multiselect/multiselect-demo.html)
Don't really know how to implement the dblclick event and would appreciate it if someone helped me out.

I would also like to remove any style change on multiselect row mouse hover.

skirtle
28 Sep 2011, 12:45 AM
The multiselect is just a wrapper around BoundList but it doesn't provide any access to the underlying config, which makes this slightly more difficult than it would otherwise be.


multiselect.boundList.on('itemdblclick', function(...) {
...
});

For styling, assuming the multiselect has a cls config of 'custom':


.custom .x-boundlist-item-over {
background-color: transparent;
border-color: white;
}

/* Respecify these as the rule above takes precedence, */
.custom .x-boundlist-selected {
background-color: #CBDAF0;
border-color: #8EABE4;
}

janhov
28 Sep 2011, 1:21 AM
Thanks a lot. Helped me out and gave me a better understanding.

skirtle
28 Sep 2011, 1:27 AM
I highly recommend reading the ExtJS source code, the answers are usually there.

janhov
28 Sep 2011, 6:27 AM
I know, but newbies like me are still not always able to solve everything :)

One more thing. It works now, but can the boundlist itemdblclick listener be added in the multiselect init config somehow? I guess not, then what is the best way of adding it so it's there when my application is loaded? Anything better than



<multiselect> {
listeners: {
afterrender: function(ms) {
ms.boundList.on........
}
}


?

skirtle
30 Sep 2011, 4:17 AM
Yeah, that's what I meant when I commented on the lack of access to the underlying config. It makes it a little trickier to register the listener.

Given the circumstances the approach you've taken looks fine to me.

Glad to hear you're digging into the ExtJS source code, most newbies either don't think of it or give up after their first bad experience. It can take a while to get the hang of reading it but you'll learn much faster that way.

janhov
30 Sep 2011, 4:47 AM
Ok thanks.