This is a migrated thread and some comments may be shown as answers.

Changing PanelBarItem in PanelBar programaticaly

2 Answers 226 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michal
Top achievements
Rank 1
Michal asked on 27 Apr 2018, 01:55 PM

Hi team telerik,
is it possible and if yes could you please provide a plunker how to change selected PanelBarItem in PanelBar after user clicks a button. I've tried to do it via binding selected and expanded properties of PanelBarItem, but this does not fire stateChange event of PanelBar.

Best regards
MichaƂ

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 30 Apr 2018, 03:28 PM
Hello Michal,

The recommended approach to programmatically expand/collapse and select/deselect the PanelBar items is indeed by binding the respective expanded and selected properties to booleans that can then be toggled from code (or to custom conditional expressions), e.g.:

https://stackblitz.com/edit/angular-gngnm1?file=app/app.component.ts

By design the stateChange event is emitted only when the state is changed as a result of user interaction via the UI, but if required you can emit it programmatically too (like demonstrated in the example above).

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Michal
Top achievements
Rank 1
answered on 07 May 2018, 01:47 PM

Thanks - your response have improved my code - I've been calling this.onStateChange(event: any[]) manually. So not it's seems to look better.

 

Tags
General Discussions
Asked by
Michal
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Michal
Top achievements
Rank 1
Share this question
or