PDA

View Full Version : Ext.Panel lazy intialization.



giri_sri_d
19 May 2009, 12:21 PM
Hello,

The issue that I am having is with the Panel (Actually not an issue, but I am trying to find a way to get my job done).

I have a panel which looks like as follows



var panel=new Ext.Panel({
title: 'Issue history',
collapsible: true,
frame: true,
collapsed:true,
listeners:{expand: function(panel1){
panel1.load({
url:"http://localhost:8080",
params:{"param1":"value1"},
text:"Loading ...",
callback:function(jsonResponse){
/*Apply jsonResponse to xTemplate and the resultant template should be
appeared in the panel */
??????
return appliedTemplateResponse;
}
});
}
}
});

panel.render(document.body);

I can see that everything is working great and I am able to figure out what should I do to apply the json response to xTemplate, but I could not figure out what should I do to have the "appliedTemplateResponse" to be applied to panel.

any help and suggestions are greatly appriciated.

Regards,
Giridhar Duggirala.

giri_sri_d
20 May 2009, 8:27 PM
Its simple all we have to do is create another component and add it to the
existing panel.

At the end we have to call panel.doLayout() so that we see the change (in layman terms)


var panel=new Ext.Panel({
title: 'Issue history',
collapsible: true,
frame: true,
collapsed:true,
listeners:{expand: function(panel1){
panel1.load({
url:"http://localhost:8080",
params:{"param1":"value1"},
text:"Loading ...",
callback:function(jsonResponse){
panel.add({
xtype:"panel",
height:"250",
html:"xTemplate.apply("jsonResponse")
});
panel.doLayout();
}
});
}
}
});

panel.render(document.body);

Regards,
Giridhar