1

I have a Ext Js panel and I want to get the Title of the panel for some purpose.

I have the id of the panel and I need to get the title of the panel from it.

I am looking for some thing like this

Ext.getCmp('myPanel').getTitle();

I am using Ext Js 3.4

1 Answer 1

6

Since no getTitle() method is defined for the component Ext.Panel, I would go for the property directly:

var myTitle = Ext.getCmp('myPanel').title;
2
  • Thanks. Its working. Is it true for any property then ? For e.g., will Ext.getCmp('myCheckBox').value work ? How do we differentiate ?
    – hop
    Feb 22, 2012 at 1:22
  • 1
    I believe that the best practice would be to use any provided methods to get access to the various properties. If a method is not available, then you could extend the component in question to provide a method, or if you just want to access the property, then get it like with the title :) There is nothing wrong with accessing the properties directly. Use a tool like FireBug to inspect the various properties and methods.
    – Chau
    Feb 22, 2012 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.