Page 1 of 1

Command Button Colors inside Datatable

Posted: 04 Feb 2019, 17:52
by glaydsongmv
How to change button colors inside datatable? If I set colors in the button still the blue color of the theme (default). Outside datatable button colors works fine.

Re: Command Button Colors inside Datatable

Posted: 06 Feb 2019, 14:30
by mert.sincan
Please try;

Code: Select all

body .ui-datatable tbody.ui-datatable-data .ui-button.ui-state-default {
   background: red;
    border-bottom: 5px solid blue;
}

body .ui-datatable tbody.ui-datatable-data .ui-button.ui-state-hover {
   background: yellow;
}

Re: Command Button Colors inside Datatable

Posted: 06 Feb 2019, 14:41
by glaydsongmv
Hi,

This code works coloring all buttons inside a datatable with the same color (red). I'm trying to use custom colors in different buttons with a tag styleClass="red-button" (for example).

Thanks.

Re: Command Button Colors inside Datatable

Posted: 07 Feb 2019, 08:16
by mert.sincan
Glad to hear, thanks a lot for the update!

Code: Select all

body .ui-datatable tbody.ui-datatable-data .red-button.ui-button.ui-state-default {
   background: red;
    border-bottom: 5px solid blue;
}

body .ui-datatable tbody.ui-datatable-data .red-button.ui-button.ui-state-hover {
   background: yellow;
}

Re: Command Button Colors inside Datatable

Posted: 23 Oct 2019, 10:01
by mert.sincan
Hi,

I think you can use $('ELEMENT_SELECTOR').focus() method or add a custom class to element to focus on. Exp; <p:commandButton ... oncomplete="$('ELEMENT_SELECTOR').focus()">

Best Regards,