Results 1 to 3 of 3

Thread: Giving onclick for list items in Extjs4

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
      0  

    Question 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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Answers
    3976
    Vote Rating
    1382
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
      0  

    Default

    Thanks for your reply mitchellsimoens.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •