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

Event for Toggleable button

3 Answers 59 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 16 Jan 2019, 11:22 PM
What is the event that should be used to react to a click event for a toggleable button.  OnClick does not work and there does no appear to be a toggle event like JQuery or selectedChange event for Angular.

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 17 Jan 2019, 08:43 AM
Hello, James,

The button with the toggleable set to true will fire the click event, but this will not provide information for the current state of the button.

I have logged this in our repository:

https://github.com/telerik/kendo-react/issues/166

Currently, I can suggest an approach that will return this information based on the class that is added to the button when it is active:

https://stackblitz.com/edit/react-temno9?file=app/main.js

I hope this is helpful.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
James
Top achievements
Rank 1
answered on 17 Jan 2019, 08:07 PM

Thanks,

Your solution does work but I should have been more specific on what doesn't work with the onClick.  We are actually using the button in the grid toolbar and when we click the button we are actually filtering the data in the grid which causes a render and thus apparently the button renders and loses it's state.  

0
Stefan
Telerik team
answered on 18 Jan 2019, 08:58 AM
Hello, James,

Thank you for the clarification.

I added this to the issue as currently, we add the active state on click, but it is not kept internally in the component state.

For a workaround, this information can be kept in the component that uses the Button and dynamically adds the active state class:

https://stackblitz.com/edit/react-temno9-8ozjmn?file=app/main.js

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
James
Top achievements
Rank 1
Answers by
Stefan
Telerik team
James
Top achievements
Rank 1
Share this question
or