1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
    Prasad gudipalli is on a distinguished road

      0  

    Question 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

  2. Code:
    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.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,227
    Answers
    3523
    Vote Rating
    859
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Code:
    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.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
    Prasad gudipalli is on a distinguished road

      0  

    Default


    Thanks for your reply mitchellsimoens.

Thread Participants: 1

Tags for this Thread