Accordion open/close without multimode?

I have an accordion that is NOT using multimode. By default when you click one of the cells titlebars, it opens completely, the other accordion cells close completely.

I tried turning multi-mode on, and I very much liked how clicking a cell opened the accordion page, while clicking it again would close it.

I did not like about multimode that I have to set the height ahead of time, and cannot specify 100%.

So how can I intercept a mouse click in an accordion cell in order to give it that “click to open, click to close” like multi-mode does, but without using multi mode?

Is it possible?

Thanks

ps. there seems to be a slight bug with enableMultiMode in that passing true turns it on, but passing false also turns it on.

You may comment the following line in the dhtmlxaccordion.js:

if (!that.multiMode && that.idPull[this._idd]._isActive) return;

And use the following approach to open next item when already open item is clicked:

dhxAccord.attachEvent("onBeforeActive",function(id){ var currentItem = dhxAccord.cells(id); var nextItem; var flag = false; if(currentItem.isOpened()){ dhxAccord.forEachItem(function(item){ if(flag){ nextItem = item; flag = false; } else if(item==currentItem) flag = true; }); (nextItem||currentItem).open(); flag = false; return false } return true })