سؤال

How can acces row css for multiple colored rows?

I try use :

.redRow .ui-datatable-even, ui-datatable-odd {
   background-color: red;
}

.blueRow .ui-datable-even, ui-datatable-odd{
   background-color: blue;
}

but it doesnt work, because primefaces theme override this. How to do something like this?

هل كانت مفيدة؟

المحلول

Make sure your css is loaded after the primefaces css, as demonstrated in this answer.

نصائح أخرى

In your component include the encapsulation: ViewEncapsulation.None to access the elements inside the datatable using css selectors.

import { Component, OnInit, ViewEncapsulation } from '@angular/core';

@Component({
    selector: 'my-component',
    templateUrl: './my-component.component.html',
    styleUrls: ['./my-component.component.css'],
    encapsulation: ViewEncapsulation.None
})
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top