SmartClient(TreeGrid)中按需颜色的行集

时间:2011-09-02 11:22:28

标签: smartclient

我在SmartClient中有一个TreeGrid。现在我想为行号3-5,7-11等设置一些颜色。我使用外部按钮将值传递给SmartClient。谁能告诉我怎么做?一个按钮正在传递值,它工作正常。但问题是,在哪里获取SmartClient中的值以及如何为这组线着色。

2 个答案:

答案 0 :(得分:0)

由于TreeGrid是一个ListGrid,我想你可以覆盖getCellStyle函数并根据需要设置颜色。

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

所以基本上是伪代码:

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

其中style1和2在css中定义

答案 1 :(得分:0)

如何使用特定样式名称(myStyle)自定义和保持状态,如:

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

我尝试使用@Override的getCellStyle 返回“myStyleA”或“myStyleB” 我想保留动态后缀:“黑暗”,“结束”,“选定”,......

一个想法?...

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