Button in Accordion cell header - how to block collapse?

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?

Hello
If you don’t need collapse, you need to set the next event handler:

dhxLayout.attachEvent("onCollapse", function(itemId){ dhxLayout.cells(itemId).expand(); });

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; }

** 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; } }

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