а

How to attachEvent under attachSidebar from Layout


#1

Here everyone, i learning and try to build using dhtmlx here

recently i using layout 2U, and i attachSidebar to cell(“a”)

But how to attachEvent to the attached sidebar? so i can know user click on which item

hope you guy/gal can understand my question, any way here is my code

var aCell = myLayout.cells(“a”);
aCell.setText(“Left Menu”);
aCell.setWidth(270);
aCell.attachSidebar({
width: 300,
icons_path: “icons_material/”,
json: “common/sidebar.json”,
attachEvent: doOnItemSelect // like this ???
});

function doOnItemSelect(id) {
alert("clicked " + id);
}

my sample can be view from HERE


#2

You can use the default form of the attachEvent applied to your tabbar object:

var aCell = myLayout.cells(“a”);
aCell.setText(“Left Menu”);
aCell.setWidth(270);
var mySidebar=aCell.attachSidebar({
width: 300,
icons_path: “icons_material/”,
json: “common/sidebar.json”,
});
mySidebar.attachEvent("onSelect", function(id, lastId){
alert("clicked " + id);
});