Active content in accordion

Hi Alexandra,

I want to add a button in the header of the accordion.
How can I implement it? Can you give me some advice?
Thank you.

Best regards,
Gainy

Hi Gainy,

There is not possibility to put views into accordion header. But you can put html content and set styles that will imitate button view.

<style> .header_button{ width: 400px; display: inline-block; text-align: right; } </style> ... dhx.ui({ ... header:"Title <div class='dhx_el_button header_button'><input type='button' value='Button'></div>", ... });

Hi Alexandra,

Okay, I'll try it later.
Thanks very much!

Regards
Gainy

Hi Alexandra,

There is another question below:
I don't want to expand the accordion item when I click the button in header.
How to block the click event?
In other words, I want to expand the accordion item after click the header except for button.
Thanks a lot.

Regards
Gainy

Hi Gainy,

You need prevent event propagation:

... header:"Title <div class='dhx_el_button header_button'><input type='button' value='Button' onclick='yourOnClickHandler(event)'></div>", ... function yourOnClickHandler(e){ if (e.stopPropagation) e.stopPropagation(); if (e.cancelBubble!=null) e.cancelBubble = true; }

Hi Alexandra,

Oh, yes, I got it.
Thanks a lot. :slight_smile: 

Regards
Gainy

You are welcome )