Sunday, March 23, 2014

How to style specific cells in CellTable depending the value of that cell (GWT)?

Ok, i have a CellTable that has 3 columns and 2 rows. I want the text in SOME specific cells (not all cell) in the table to be BOLD.

Please look at this code:

ListDataProvider<List<String>> dataProvider = new ListDataProvider<List<String>>();  dataProvider.addDataDisplay(table);  List<List<String>> list = dataProvider.getList();  List<String> sublist1= Arrays.asList("223","546","698");  List<String> sublist2= Arrays.asList("123","876","898");  List<String> sublist2= Arrays.asList("123","896","438");  IndexedColumn column1=new IndexedColumn(0);  table.addColumn(column1, "Col1");  IndexedColumn column2=new IndexedColumn(1);  table.addColumn(column2, "Col2");  IndexedColumn column3=new IndexedColumn(2);  table.addColumn(column3, "Col3");  

Now, I want the Cell that is the intersect of row2 & col3 (ie "898") to be BOLD, so if i do like this

column3.setCellStyleNames(getView().getRes().css().myBoldColor());  

Then it will make the whole column BOLD.

So, i think properly we need to loop over each cell in column3 & set the style accordingly, so that we can have the result like this:

Col1 - Col2 - Col3  223 - 546 - 698  123 - 876 - 898  123 - 896 - 438  

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment