Style JSF datatable with primefaces?

I think there are many ways to color a datatable with CSS. For me it worked by displaying a list where each item also has an ID, so I used.

I think there are many ways to color a datatable with CSS. For me it worked by displaying a list where each item also has an ID, so I used: the CSS File . Old { background:#fafafa; } now every second row has a different color.

I didn't understand this id="xyzDataTable" and data. Id – Optimmus May 28 at 12:45 xyzDataTable is simple a random id for the p:dataTable and data. Id is the ID column of my data source because I use a data source which is numbered so I only set every even number (every second line) with another background color.

– Ziagl May 30 at 6:44.

Another solution: you can use JavaScript. For my DataTable I wanted to color the column and the line of the element which has the focus. The DataTable contains many inputText elements, each of them calls that JavaScript Function if it gets the focus: with the JavaScript Function: //colors row function colorTR(row, cell){ var x = document.

GetElementsByTagName('tr'); var count = x. Length; for(var i=0; i! =count; ++i){ if(xi.

Id0 == 'p'){ if(i%2 == 0) xi.style. Background = '#eeeeee'; else xi.style. Background = '#fafafa'; var zahl = parseInt(xi.idxi.id.

Length-2 + xi.idxi.id. Length-1); if(isNaN(zahl)) zahl = parseInt(xi.idxi.id. Length-1); if(zahl == row) xi.style.

Background = '#feac5b'; } } //colors column x = document. GetElementsByTagName('input'); count = x. Length; for(var i=0; i!

=count; ++i){ if(xi. Id0 == 'p'){ xi.parentNode.style. Background = 'transparent'; var zahl = parseInt(xi.idxi.id.

Length-2 + xi.idxi.id. Length-1); if(isNaN(zahl)) zahl = parseInt(xi.idxi.id. Length-1); if(zahl == cell) xi.parentNode.style.

Background = '#feac5b'; } } //header column x = document. GetElementsByTagName('th'); count = x. Length; for(var i=0; i!

=count; ++i){ if(xi. Id0 == 'p'){ xi.style. Background = '#ffffff'; var zahl = parseInt(xi.idxi.id.

Length-2 + xi.idxi.id. Length-1); if(isNaN(zahl)) zahl = parseInt(xi.idxi.id. Length-1); if(i == cell) xi.style.

Background = '#feac5b'; } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions