Component class

7 January

Posted by anonym

  • Dear Community,

    How can I get the class of a button. I can see the addClass & removeClass APIs, but what about getClass?

    Thanks.


  • Sorry and... thank you :">


  • Dear Jozef,

    As I told you in a previous thread of mine, I'm trying to handle button style when they're pressed. You gave me a nice tip, thank you again. =D>

    But could you please tell me why Firebug tells me Ext.get("id_btn_" + menu_1_crt).getEl is not a function when I would like to check if my toolbar button has already been just pressed? :((


    if (!Ext.get('id_btn_' + menu_1_crt).getEl().hasClass("x-btn-pressed")) {
    for (var i = 1; i < (menu_1_count + 1); i++) {
    Ext.get('id_btn_' + i).removeClass("x-btn-pressed");
    }
    Ext.get('id_btn_' + menu_1_crt).addClass("x-btn-pressed");
    }


    Thank you.


  • Generally, css classes are not applied to Components but to Elements. You can use hasClass method of Element to check if it has one particular class or you can get all classes by el.dom.className.


  • It's because Ext.get returns Element and Element has no method getEl. You most likely want to get Component so you need to use Ext.getCmp method. Most components (or all?) have method getEl.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Component class , Please add it free.

    edit

    SanOne Infrastructure at Storage Networking World Roberts: ICANN's Health Remains Strong