Primeng: p-panel toggle on header click

Created on 7 May 2018  路  4Comments  路  Source: primefaces/primeng

How can i toggle p-panel on header click, now it toggle only when i click plus and minus icon

new feature

Most helpful comment

Added toggler property;

<p-panel toggler="icon |聽header"

Setting it to header gives you the required behavior.

All 4 comments

For now is not possible @rashnk. If you want to achieve this behaviour you should use the collapsed attribute and manage manually the value.
Take care about this solution because if you use this way, you loose the event onBeforeToggle. This seems to be a bug, what do you think @cagataycivici ?

Anyway I think this is a common behaviour that can be an option of this component.

@cagataycivici if you want I can do the PR, it's very easy, just use the following code:

On the template (panel.ts):

(@panelContent.start)="onToggleStart($event)"

On the component (panel.ts):

onToggleStart(event: Event) {
  this.animating = true;
  this.onBeforeToggle.emit({originalEvent: event, collapsed: this.collapsed});
}

And remove the lines 85-86 from the panel.ts

Added toggler property;

<p-panel toggler="icon |聽header"

Setting it to header gives you the required behavior.

.ui-panel .ui-panel-titlebar .ui-panel-titlebar-icon{
width:100% !important;
}

after that

span.pi-minus{
float:right !important;
}
span.pi-plus{
float:right !important;
}
this css trick will work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Helayxa picture Helayxa  路  3Comments

just-paja picture just-paja  路  3Comments

papiroca-tm picture papiroca-tm  路  3Comments

jisqaqov picture jisqaqov  路  3Comments

philly-vanilly picture philly-vanilly  路  3Comments