Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mark on Jan 12, 2009 06:50
open dhtmlx forum
Collapse all accordion cells

Hello,

Is it possible to collapse all cells?

Thanks
Answer posted by Support on Jan 13, 2009 03:01
Hello,

dhtmlxAccordion does not have such functionality.
Answer posted by Mark on Jan 13, 2009 08:34

Hi,

Would it be possible for me to go into the source and try to enable this behavior?   If so, could you please point me to where I should look?

 

Thanks

Answer posted by Support on Jan 13, 2009 09:24
Sorry for inconvenience, there was an error in previous anser, you can do this using closeItem() method.

dhxAccord.closeItem(itemId);




Answer posted on Jan 13, 2009 10:02

Hi,

When I tried this, using the following code:

var dhxAccord = new dhtmlXAccordion("accordObj","dhx_blue");

//dhxAccord.setEffect(true);

dhxAccord.addItem("a1", "Mark's Dev");

dhxAccord.addItem("a2", "Old UAT");

dhxAccord.addItem("a3", "Google");

dhxAccord.cells("a1").attachURL("http://yahoo.com");

dhxAccord.cells("a2").attachURL("http://ebay.com");

dhxAccord.cells("a3").attachURL(http://www.google.com);  // this is open by default since it is the last one

dhxAccord.closeItem("a3");

 

The last cell doesn't really collapse, it just fills the background with the default skin color.

 

What I'm trying to do is have all cells collapse, and when clicking on an already open cell, having that cell collapse. 

 

Could you direct me on how I could modify the source to achieve this?

 

Thanks

 

Answer posted by Support on Jan 14, 2009 00:29
Cell is collapsed, but global container ("accordObj" in your case) stays after collapsing all cells and it have this background color.
Try to change its height after collapsing last cell, and restore height to previous before expanding any one.