سؤال

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.

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

المحلول

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

نصائح أخرى

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 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top