0

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

4

2 回答 2

0

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

  • 我的风格
  • myStyleDark
  • myStyleOver
  • myStyleOverDark
  • myStyleSelected
  • myStyleSelectedDark
  • myStyleSelectedOver
  • myStyleSelectedOverDark
  • 我的样式已禁用
  • myStyleDisabledDark

我尝试使用 getCellStyle 的 @Override 来返回我想要保存动态后缀的“myStyleA”或“myStyleB”:“Dark”、“Over”、“Selected”...

一个主意 ?...

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 
于 2012-04-30T16:04:18.677 回答
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 中定义

于 2011-09-02T22:03:02.723 回答