Accordion MultiMode - Open All

Hello,

I’m trying to provide a link above an accordion to click and “Open All” items.

The Accordion has a twelve Items that are Grids and takes a few seconds to load if all at once.

So I have implemented lazy loading with the accordion’s onBeforeActivate, where each Item checks whether it’s associated grid has been created.

The best I could find in the documentation to maybe trigger an item by way of code was setActive, so I tried…

[code]

dhxAccord.cells(id).view(dhxAccord.cells(id).getText()).setActive();
[/code]

but that did not trigger the onBeforeActivate.

I also tried dhxAccord.callEvent() but can’t quite find how to specify accordion cell items.

Any suggestions as to how I might open all accordion items, where they may still have to attach and load grids if they haven’t yet.

Thank you,

Mike

Hello,

dhxAccord.cells(id).view(dhxAccord.cells(id).getText()).setActive(); makes a certain view visible and doesn’t relate opening accordion item.

It seems that there is no need to call event. You may manually call the function that loads grids.

function openAll(){
dhxAccord.forEachItem(function(item){
item.open();
})
for(var i=0;i<grids.lengths;i++){
if(!grids[i].getRowsNum())
grids[i].loadXML(…);
}
}

Open All

Here “grids” is an array of grids that are created in accordion.

We also have to set height, so I don’t think I am able to use an array of grids. I first tried and the index is out of scope when calling function ().

http://forum.dhtmlx.com/viewtopic.php?f=5&t=20118

It still would be really nice if the Grid was available by way of the Accordion object so is available in the forEachItem().

Or else the call event could still be handy be in forEachItem. Because currently I have to hard code globally, and direct reference grid1, grid2, etc…

Thank you,

Mike

If Grid is attached to the “a” cell of dhxLayout, you may use the following approach to get it:

var grid = dhxLayout.cells(“a”).getView().grid;

Niiiiice…

Thanks again, - Mike