【问题标题】:Smart GWT - change text color of clicked record in ListGrid智能 GWT - 更改 ListGrid 中单击记录的文本颜色
【发布时间】:2016-04-01 15:32:48
【问题描述】:

我正在使用 Smart GWT 版本 4。我想在记录单击操作时更改所选记录的文本颜色。我找不到使用“setHilites”方法或其他任何方法的方法。我怎样才能做到这一点?

【问题讨论】:

    标签: record smartgwt listgrid


    【解决方案1】:

    如果你使用 BaseStyle 的方式,它是这样的。

        @Override
    protected String getBaseStyle(ListGridRecord record, int rowNum, int colNum){
    
        if (listGrid.getSelectedRecord() == record){
            return "custom-color-CSS";
        }
    
        return super.getBaseStyle(record, rowNum, colNum);
    }
    

    }

    【讨论】:

      【解决方案2】:

      在 ListGrid.getCellCSSText 或 ListGrid.getBaseStyle 方法中,您可以使用 ListGrid.isSelected(record) 来返回适当的样式。

      【讨论】:

      • 感谢您的回复。我已经尝试了上述方法,但没有运气。 ListGrid.getCellCSSText 方法和 ListGrid.getBaseStyle 方法都为我返回 null。无论如何,我认为实现此要求的另一种方法是为网格设置一个刀柄。有没有办法在记录点击操作中将 set hilite 设置为列表网格?我试过调用“Listgrid.setHilites("hilite_name");”在列表网格的单击处理程序处。但它没有生效。
      • 抱歉,我可能不太清楚:您必须实现 getBaseStyle 或 getCellCSSText 方法,如以下示例:smartclient.com/smartgwt/showcase/#grid_appearance_hilite_addsmartclient.com/smartgwt/showcase/…
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多