You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scale Version
"@telekom/scale-components": "^3.0.0-beta.132",
"@telekom/scale-components-react": "^3.0.0-beta.132"
Framework and version
React
"react": "^17.0.2"
Hello there,
I am trying to use a checkbox (switch) on data grid component in react that displays a list of users. I would like to be able to toggle the switch to activate or deactivate a user by calling a function. In other words, I will like to be able to respond to event when the switch(checkbox) is changed. I have tried using event handlers like onClick, onChange, onScaleChange but the function is not triggered. Please is there a way I can achieve this with Scale?
const rows = activatedUsers.map((user) => ([
user.email,
user.roles,
// if user object has an active property you could do:
// user.active ? true : false
// judging by the mapped array name 'activeUsers' i guess they can only be deactivated
true
The scale-change event listener should be set on the ScaleDataGrid (or on window/document), so it would look something like this:
and this should log the rows with the updated values (when switched off they will be false).
I based my answer on #811 a little, where a somewhat similar issue was described, perhaps that can help you too.
Regarding the switch label, this seems not possible with the current implementation, and adding this would be a feature request (btw scale users are always welcome to open pull requests for such improvements 🤓).
Scale Version
"@telekom/scale-components": "^3.0.0-beta.132",
"@telekom/scale-components-react": "^3.0.0-beta.132"
Framework and version
React
"react": "^17.0.2"
Hello there,
I am trying to use a checkbox (switch) on data grid component in react that displays a list of users. I would like to be able to toggle the switch to activate or deactivate a user by calling a function. In other words, I will like to be able to respond to event when the switch(checkbox) is changed. I have tried using event handlers like onClick, onChange, onScaleChange but the function is not triggered. Please is there a way I can achieve this with Scale?
I have tried implementing it the following way
I have also noticed that the heading is the same as label of the switch. Is it possible to decouple them from each other?
Thanks a lot.
The text was updated successfully, but these errors were encountered: