Hi Guys,
I am using Rain theme. I would like to change the color of my button if it disabled.
I would like to change the color of the button to light grey if it is disabled. If it is not disabled it is red.
Can please someone tell me how to do that?
<p:commandButton id="cancelButton"
value="#{msg['prod.cancel']}"
icon="fas fa-undo" styleClass="danger-button p-mr-2"
style="width:auto;" ajax="true" update="update"
actionListener="#{cancelProd}"
disabled="#{!prod.isCancelable()}">
<p:confirm
...etc>
</p:commandButton>
Many thanks and best regards,
Krisztyan
Primefaces version: 8.0.4
Rain theme: 1.0.0
Changing the color of a button if it is disabled
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Hi,
Please try;
Best Regards,
Please try;
Code: Select all
<p:commandButton styleClass="#{!prod.isCancelable() ? 'custom-light-grey' : 'danger-button'} p-mr-2" disabled="#{!prod.isCancelable()}">
Github Profile: https://github.com/mertsincan
Hi Mert Sincan,
thank you for your help. Now the color of the button is light grey as expected.
Unfortunately now I lost the margin to the right. p-mr-2 not recognized.
I have two buttons next to each other in the same line horizontally and there is no margin between them anymore.
The styleclass of the two buttons are the same.
Like:
Could you please help with that?
Many thanks and best regards,
Krisztyan
thank you for your help. Now the color of the button is light grey as expected.
Unfortunately now I lost the margin to the right. p-mr-2 not recognized.
I have two buttons next to each other in the same line horizontally and there is no margin between them anymore.
The styleclass of the two buttons are the same.
Like:
Code: Select all
First:
styleClass="#{!prod.isCancelable() ? 'custom-light-grey' : 'danger-button'} p-mr-2}" disabled="#{!prod.isCancelable()}">
Second:
styleClass="#{!prod.isCancelable() ? 'custom-light-grey' : 'danger-button'} p-mr-2}" disabled="#{!prod.isCancelable()}">
Many thanks and best regards,
Krisztyan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests