I added some buttons in cell header, but clicking on these buttons lead to cell collapse even if onClick return false.
myLayout.cells("a").setText('<input type="button" value="Click me!" onclick="return false;">');
how to block collapse of the cell on my button click?
Darya
August 26, 2015, 11:24am
#2
Hello
If you don’t need collapse, you need to set the next event handler:
dhxLayout.attachEvent("onCollapse", function(itemId){
dhxLayout.cells(itemId).expand();
});
cbaket
September 23, 2015, 10:59am
#3
Hi! the answer below didn’t work for me as i use accordion and the button is in a accordion cell.
I tried a workaround that did the job for me.
//create the cell:
myAccordion.addItem('a1','Test <button id="idButton" style="position:absolute; right:0; width:30px; height:100%;"> </button> ',true,300);
//add onclick event to the button:
document.getElementById('idButton').onclick = function(e){
stopPropagation(e);
// your code for the button click action...
};
** where stopPropagation(e) is the following code:
function stopPropagation(e){
e = e || window.event;
e.cancelBubble = true;
}
cbaket
September 23, 2015, 11:16am
#4
** I was working on ie8, so you may use the following code:
function stopPropagation(e){
e = e || window.event;
if (typeof e.stopPropagation != "undefined") {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
}
Andrei
September 25, 2015, 11:44am
#5
Hi
Could you please provide us complete demo including all correspondnig js/css files?
Please also add information regarding current and expected behaviour.
Here is a small guide how to make a complete demo:
docs.dhtmlx.com/tutorials__auxil … pport.html
If you’re using PRO or ENT edition, please send your demo to support@dhtmlx.com