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

Kendo PanelBar navigation

2 Answers 202 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 16 Mar 2018, 11:26 PM

Hi

I have a question on the kendo-panelbar

I added an event handler for stateChange, and in some cases, I want my user to stay on the current panelbar Item.  

Basically, If I have a validation error, i want my user to stay on the current panelbar item and not navigate to the panelbar item they clicked

    public onStateChange(data: Array<PanelBarItemModel>): boolean {
            const previousItem: PanelBarItemModel = data.filter(item => item.focused === false)[0];
            const currentItem: PanelBarItemModel = data.filter(item => item.focused === true)[0];

    .........

                    if (previousSection === 'blah blah'&& !wasSuccessful) {
                        currentItem.selected = false;
                        currentItem.expanded = false;
                        previousItem.selected = true;
                        previousItem.expanded = true;

 

However, my panelBar item does not return to the current panelBar Item

What must I do in order to achieve this navigation?

Thanks


2 Answers, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 20 Mar 2018, 12:58 PM
Hi David,

We can programmatically change the expanded and selected input properties of the PanelBarItem component in order to achieve the desired behavior. In case the form is invalid, on (stateChange) event we can set all PanelBarItems to be not selected and not expanded. Then we will also expand and select just the needed PanelBarItem. Please check the following sample plunker demonstrating this approach:

https://plnkr.co/edit/FVgUv517XD1R2MPpddKQ?p=preview

I hope this helps. Please let me know in case further assistance is required for this case.

Regards,
Svetlin
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
David
Top achievements
Rank 1
answered on 20 Mar 2018, 07:40 PM

Hi Svetlin

It works great !!  Thank you very much

Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Svet
Telerik team
David
Top achievements
Rank 1
Share this question
or