- Home
- Forum
- React - EJ 2
- How can I apply changes to the toolbarTemplate?
How can I apply changes to the toolbarTemplate?
Hi,
I'm managing the active state of buttons within the toolbarTemplate using useState, but changes to the state aren't reflected on the screen.
Is there a way to resolve this?
Sample:https://stackblitz.com/edit/react-jvfimn8r?file=App.js
Hi ,
Greetings from Syncfusion support,
To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.
|
const click = () => { const newState = !buttonDisable; setButtonDisable(newState); if (buttonRef.current) { buttonRef.current.disabled = newState; } }; <ButtonComponent id="addButton" ref={buttonRef} cssClass="e-outline" disabled={buttonDisable} > test </ButtonComponent> |
Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
Regards,
Kishore Muthukrishnan
Hi ,
Greetings from Syncfusion support,
To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.
|
const click = () => { const newState = !buttonDisable; setButtonDisable(newState); if (buttonRef.current) { buttonRef.current.disabled = newState; } }; <ButtonComponent id="addButton" ref={buttonRef} cssClass="e-outline" disabled={buttonDisable} > test </ButtonComponent> |
Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
Regards,
Kishore Muthukrishnan
Hi ,
Greetings from Syncfusion support,
To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.
|
const click = () => { const newState = !buttonDisable; setButtonDisable(newState); if (buttonRef.current) { buttonRef.current.disabled = newState; } }; <ButtonComponent id="addButton" ref={buttonRef} cssClass="e-outline" disabled={buttonDisable} > test </ButtonComponent> |
Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
Regards,
Kishore Muthukrishnan
Hi ,
Greetings from Syncfusion support,
To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.
|
const click = () => { const newState = !buttonDisable; setButtonDisable(newState); if (buttonRef.current) { buttonRef.current.disabled = newState; } }; <ButtonComponent id="addButton" ref={buttonRef} cssClass="e-outline" disabled={buttonDisable} > test </ButtonComponent> |
Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
Regards,
Kishore Muthukrishnan
Hi ,
Greetings from Syncfusion support,
To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.
|
const click = () => { const newState = !buttonDisable; setButtonDisable(newState); if (buttonRef.current) { buttonRef.current.disabled = newState; } }; <ButtonComponent id="addButton" ref={buttonRef} cssClass="e-outline" disabled={buttonDisable} > test </ButtonComponent> |
Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
Regards,
Kishore Muthukrishnan
Hi ,
Greetings from Syncfusion support,
To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.
|
const click = () => { const newState = !buttonDisable; setButtonDisable(newState); if (buttonRef.current) { buttonRef.current.disabled = newState; } }; <ButtonComponent id="addButton" ref={buttonRef} cssClass="e-outline" disabled={buttonDisable} > test </ButtonComponent> |
Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
Regards,
Kishore Muthukrishnan
Hi ,
Greetings from Syncfusion support,
To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.
|
const click = () => { const newState = !buttonDisable; setButtonDisable(newState); if (buttonRef.current) { buttonRef.current.disabled = newState; } }; <ButtonComponent id="addButton" ref={buttonRef} cssClass="e-outline" disabled={buttonDisable} > test </ButtonComponent> |
Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
Regards,
Kishore Muthukrishnan
- 7 Replies
- 2 Participants
-
AK Akira Kume
- Oct 3, 2025 10:39 AM UTC
- Oct 7, 2025 05:08 AM UTC