PDA

View Full Version : Add new accordion in Ajax



cyfl
2 Jul 2008, 12:22 AM
Good morning,

I would like to dynamically load the elements of my accordion in ajax.
The creation of elements goes well, but I do not see the result, the only solution that I find for voirs was creating a fix elements and click on it to the fold / unfold, and at this moment I see all my elements creates by Ajax

I hope that is clear!
(regrettable for my English, I'm french!)

my accordion :


var Menu_Modules = new Ext.Panel({
title: 'Modules'
,id:'Menu_Modules'
,layout:'accordion'
,collapsible: true
,split:true
,layoutConfig: {
animate: true
}
});
my ajax code :


function Build_Menu_Modules(){
Ext.Ajax.request({
url: 'iRequestToServeur.aspx'
,waitMsg:'Chargement...'
,params: {TYPE_REQUEST:'31' }
,success: function(response, success){
var ListesModules = Ext.decode(response.responseText).ListesModules;
for (i=0; i<ListesModules.length; i++) {
Menu_Modules.add({
title: ListesModules[i].DOSSIER
,html: 'content'
,closable:true
,autoScroll:true
}).show();

}
}
});

Menu_Modules.add({
title: 'TITLE FIX '
,html: 'TITLE FIX'
}).show();
}
Build_Menu_Modules();

evant
2 Jul 2008, 12:42 AM
You need to call doLayout on the container after adding an item.

See: http://extjs.com/learn/LayoutFAQ

cyfl
2 Jul 2008, 12:45 AM
Thanks a lot, it's that !
=D>