This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

dynamic rowclasses

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a datatable that I want to set the rowclasses based on data that is in the rows
for example: if a hava a column named number and the first one is 5 I want that row to be style class1. If the next row matches that number I want it to have the same rowclass(class1) if the number is different say 8 I want it to have a different rowclass (class2) so that all consequtive numbers have the same rowclass. My problem is not with the logic but rather with setting the rowclass.

The following method is in a column in my datatable

/**
* @return Returns the rowClass.
*/
public String getRowClass() {

String s = String.valueOf(getValue("#{varPerson['NUM']}"));

if (s != null && (s.compareTo(getNewCcn())==0)) {


} else {

if(rowClass.compareTo("rowClass1")==0){
rowClass="rowClass2";
}else if(rowClass.compareTo("rowClass2")==0){
rowClass="rowClass1";
}
}

setNewCcn(s);

return rowClass;
}
 
I don't like that guy. The tiny ad agrees with me.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic