Get date from weekview and UnitID(key) from unitsview

I use unitsview and weekview in scheduler
I need to pass unitID(key) and date to another function when i click header of classname: dhx_scale_bar.
I tried this code:

function showTitle(a) {
    alert(a);
    debugger;
    var mode = scheduler.getState().mode;
    var myDate = scheduler.getState().date;
    alert(myDate);


    });
    if (mode == "units")
    {
        var hh= scheduler.getState().date;
        alert(hh);
        alert(mode);
//getting date correctly,
but how to get unitId i used to populate unitsview
   
    }
    else if (mode == "week" || mode=="decade") {

        var a = document.getElementById('resourcename');
        var cid = a.options[a.selectedIndex].value;
//here I get the unitId as i use list to filter_week.
        var n = scheduler.getState().date;
        alert(n);
// I get the same date whenever i tried to click on any column in weekview or decade view
    }   
}

I attached showTitle(a) function in the main dhtlmxscheduler.js as I dont find any documentation to attachevents on header. Please help.

You can use

var unit = scheduler.getActionData(e).section;

where e - native html click event object

i get error saying e is not defined

Yep, in above code snippet you have not such variable.
I’m not sure how you are calling showTitle from the onclick event, but the onclick event handler receives the event (e) as first parameter for sure.