Here I am sharing some tips that would be useful for you while working with ExtJs. These tips are about issues I faced while working on ExtJs projects.
1) Get-Set ExtJs Panel HTML
I don’t know how many of you faced this issue. While working on one project, requirement was to set panel HTML dynamically. If you check Panel class there is not any method like getHtml() setHtml(). Following is the solution for it.
var dynamicHtml = ‘<div> This is dynamic HTML</div>’;
myPanelObj.body.dom.innerHTML = dynamicHtml;
This will set panel HTML. Same way you can get panel HTML using myPanelObj.body.dom.innerHTML.
2) ExtJs Window me.Events are undefined error
If you are extending ExtJs window and on creating object of extended control, if you get above error then you forgot to call base class constructor. Call the base class constructor using following code.
ExtendedWindowObject.superclass.constructor.call(this, config);
3) Set padding while using ExtJs panel table layout.
When you use table layout in ExtJs panel layout. All the controls are arranged in a table. Sometimes it does not look good if you don’t give padding to it. It looks very clumsy. So to give padding give id to panel and create a class in CSS with name of that id. See the example below.
#myPanelObj td{
padding:5px;
},
