Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ritchie Masterson on Oct 22, 2009 07:49
open dhtmlx forum
update the Accordian Item selected css

Hey Guys,
Is there a way to define the selected accordian item style in the css file or by code, in order to highlight the current item that is open (ie. set a different bg color)

Rgds,
Ritchie.
Answer posted by Alex (support) on Oct 22, 2009 08:58

Hello, 

there is no public solution to do that. Try to set onActive handler with the following code:  

dhxAccord.attachEvent("onActive", function(){

    this.forEachItem(function(item){
        if (item.className!="dhx_acc_item_hidden") {
        item.className = "dhx_acc_item"+(item._isActive?" active":"");}

    });

});

also you should define a class with the necessary background:

div.dhx_acc_base_dhx_skyblue div.dhx_acc_item.active div.dhx_acc_item_label { }

to call onActive event initially you can use dhxAccord.callEvent("onActive",[itemId]) method.


Answer posted by Ritchie Masterson on Oct 22, 2009 08:59
Thanks Alex, that solution is great.