PDA

View Full Version : Giving onclick for list items in Extjs4



Prasad gudipalli
29 Nov 2011, 3:07 AM
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:


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();

mitchellsimoens
29 Nov 2011, 10:56 AM
win.mon(win.el, {
scope : win,
delegate : 'li',
click : function() {...}
});

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.

Prasad gudipalli
30 Nov 2011, 5:32 AM
Thanks for your reply mitchellsimoens.