Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add click event on Extjs 4 label

I try to add click event on label in extjs4 but not working

Ext.onReady(function() {

    var ResetLabel = new Ext.form.Label({
        id:'ResetLabel',
        text: 'click it',
        renderTo : document.body                                

    });
    alert(Ext.getCmp('ResetLabel').id);

    Ext.getCmp('ResetLabel').on('click',function(){

        alert("message");
    });

});

How to add event on a label?

like image 257
jayesh Avatar asked Dec 09 '22 06:12

jayesh


1 Answers

this code is working in Extjs 4

Ext.onReady(function() {

    var ResetLabel = new Ext.form.Label({
        id:'ResetLabel',
        text: 'click it',
        renderTo : document.body                                

    });
    alert(Ext.getCmp('ResetLabel').getEl());

    Ext.getCmp('ResetLabel').getEl().on('click',function(){

        alert("message");
    });

});
like image 79
jayesh Avatar answered Feb 01 '23 22:02

jayesh