-
29 Nov 2011 3:07 AM #1
Answered: Giving onclick for list items in Extjs4
Answered: Giving onclick for list items in Extjs4
I am creating a modal window by using Extjs4. In that modal window I have list items I want give on click for that list items. Can any one help me how to give on click for list item?
Here is my code:
Code:var win; win = Ext.widget('window', { title: 'Import HTML', closeAction: 'hide', bodyStyle:'padding:10', html: { tag:'ul', children:[ {tag:'li',html:'Images'}, {tag:'li',html:'RH-2011 UK Login Welcome',id:'htmltamplate'} ] }, width: 250, height:200, layout: 'fit', resizable: true, collapsible: true, modal: true, buttons: [{ text: 'Ok', handler: function() { this.up('window').hide(); } }, { text: 'Cancel', handler: function() { this.up('window').hide(); } }] }); win.show();Last edited by skirtle; 29 Nov 2011 at 10:46 AM. Reason: Add CODE tags and fix code white-space
-
Best Answer Posted by mitchellsimoensThe important part is the delegate config. This is a DOM selector to pick what child under the element past as the first argument in the mon() method, in this case win.el.Code:
win.mon(win.el, { scope : win, delegate : 'li', click : function() {...} });
-
29 Nov 2011 10:56 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
The important part is the delegate config. This is a DOM selector to pick what child under the element past as the first argument in the mon() method, in this case win.el.Code:win.mon(win.el, { scope : win, delegate : 'li', click : function() {...} });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
30 Nov 2011 5:32 AM #3


Reply With Quote