PDA

View Full Version : How to expand one Panel



lumulumu
16 Sep 2007, 4:56 AM
Hi,

I just started working with Ext and I find it greet. But I got a Problem:
I build up the accordion and everything functions fine. The accordion contains panels which load their content with an Ajax request. The functions checks if the content is new every x Minutes. Now if the content is new (this function works) I like to expand the panel. And thats the Problem I do not know how just to expand one special panel. Can anybody please give me a hint. I tried expandPath and getPath but it won't work.

Here is an exapmle code.


Ext.onReady(function() {
// create accordion
var acc = new Ext.ux.Accordion('acc-ct', {
fitHeight: false
})

// create panel 1
var panel1 = acc.add(new Ext.ux.InfoPanel('panel-1', { icon: 'scripte/gfx/tux.png'
}));

// create panel 2
var panel2 = acc.add(new Ext.ux.InfoPanel('panel-2', { icon: 'scripte/gfx/email.png'
}));

});

This Function is call from the Ajax request if succesfull.


function suc(res){
var tempID = Ext.util.JSON.decode(res);


if ( tempID.id == id ){
return
}else{
showResult(tempID.headline);
id = tempID.id;
Ext.get('headline').update(tempID.headline);
Ext.get('text').update(tempID.text);
// here is the function missing to expand the panel
}
}


Thanks a lot for your help.

Manu

steffenk
16 Sep 2007, 9:12 AM
you can expand an Panel very easy:
panel1.expand(skipAnimation);

look in source code for all the methods ;)

lumulumu
16 Sep 2007, 11:43 PM
Thank you for the quick reply.
Danke!
Manu

lumulumu
17 Sep 2007, 8:50 AM
Sorry but I've got an other question. How do I get get panel1 outside the function. Because the variable is just declared local.
Thanke
greetz
Manu

steffenk
17 Sep 2007, 9:43 AM
then you have to make the var global.