PDA

View Full Version : Listen for Selection and De-selection in the List componet



porticue
30 Nov 2010, 6:50 AM
I would like to react to the selection and de-selection of each item in a list. Basically I would like to be able to do something to the selected item when clicked and would also like to be able to react to a when another item is selected. For example if an item is selected I would like to add another line of text to the list item, but remove it if another item is selected. Is this possible? and any examples or help would be greatly appreciated. Thanks

Stoot98
30 Nov 2010, 7:50 AM
You probably want to use the itemtap and the selectionchange events (or a combination thereof) of the List.

porticue
30 Nov 2010, 12:11 PM
I'm really new with Sencha. Do you have any example of event listening as it pertains to the List component, or where I could find some. Thanks

Stoot98
1 Dec 2010, 2:01 AM
//where 'this' refers to your List and arg1, arg2, argN are defined in the docs for that event
this.on('eventname', function(arg1, arg2, argN){
//do stuff
}, this);