0

I have a TreeGrid in SmartClient. Now I want to color some set of lines like line numbers 3-5, 7-11 etc. I am using an external button which passes the values to the SmartClient. Can anybody tell me how to do that? A button is passing the value and it's working fine. But the problem is, where to get the value in SmartClient and how can I color that set of lines.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

2 Answers2

0

And how to custom and keep states with using specific style name (myStyle) like :

  • myStyle
  • myStyleDark
  • myStyleOver
  • myStyleOverDark
  • myStyleSelected
  • myStyleSelectedDark
  • myStyleSelectedOver
  • myStyleSelectedOverDark
  • myStyleDisabled
  • myStyleDisabledDark

I try to use @Override of getCellStyle for returning "myStyleA" or "myStyleB" which i want conserve dynamics suffixs : "Dark", "Over", "Selected", ...

An idea ?...

http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/grid/ListGrid.html

The state of the record is indicated by adding a suffix to the base style.
There are four independent boolean states, which are combined in the order given:

"Disabled" : whether the cell is disabled; enable by setting the "enabled" flag on record returned by getCellRecord
"Selected" : whether cell is selected; enable by passing a Selection object as "selection"
"Over" : mouse is over this cell; enable with showRollovers
"Dark" : alternating color bands; enable with alternateRowStyles 
immobiluser
  • 349
  • 1
  • 2
  • 12
0

Since TreeGrid is a ListGrid, I would imagine you could override the getCellStyle function and set the colors as you see necessary.

http://www.smartclient.com/docs/8.1/a/b/c/go.html#search=getcellstyle

So basically in pseudo code:

if (row >= 3 and row <=5)
     return "style1"
if (row >= 7 and row <=11)
     return "style2"
else
     return this.baseStyle

where style1 and 2 are defined in css

dispake
  • 3,259
  • 2
  • 19
  • 22
  • Thanks, I and selecting starting and end row number through buttons. can you tell me how to do it. I have prev and next button, and I want auto refresh also. – manish987654321 Sep 05 '11 at 06:24
  • Not sure what you're asking but I suggest looking at the CSS stylesheet and seeing how they deal with selected rows. You could easily override any of the other functions of a ListGrid like setSelected() just as you would with the getCellStyle() function above. – dispake Sep 05 '11 at 19:35