How avoid that the onActive event opens the selected item.
I have this code:
…
dhxAccord.attachEvent(“onActive”, onActive);
…
function onActive(itemId) {
if(itemId==“something”)
return false;
}
But this not works!
Thx
Modify your dhtmlxaccordion.js file like this:
find:
this.addItem = function(itemId, itemText) {
…
label.onclick = function() { that.openItem(this._idd, “dhx_accord_outer_event”); }
…
}
and replace with:
this.addItem = function(itemId, itemText) {
…
label.onclick = function() {
if (that.checkEvent(“onBeforeActive”)) {
if (that.callEvent(“onBeforeActive”, [this._idd])) {
that.openItem(this._idd, “dhx_accord_outer_event”);
}
} else {
that.openItem(this._idd, “dhx_accord_outer_event”);
}
}
…
}
then in main code add after init:
dhxAccord.attachEvent(“onBeforeActive”, function(id){
return true; // allow event
return false; // or without any return - deny event
});