简体   繁体   English

在GWT的网格中更改Column的值

[英]Change the value of the Column in a grid in GWT

I am working on GXT 2.5.5 我正在使用GXT 2.5.5

I have desinged a GRID in a project 我已经在项目中设计了GRID

In one column of the grid i have render a composite 在网格的一列中,我渲染了一个合成

It looks like this 看起来像这样

格

This Choose evaluation column is Composite which is rendered in the Grid. “选择”评估列为“合成”,在网格中呈现。

public class Evaluation extends Composite {
    private RadioGroup rdgrpEvaluation;
    private Radio radio_1;
        // More radion buttons
    private Radio radio_10;        
}

All the radio_x.setValue(true) in the grid are set from the Model 网格中的所有radio_x.setValue(true)都是从Model设置的

int key = model.get("radioEvaluation");
switch (key) {
    case 1:
         evaluation.getRadio_1().setValue(true);
         break;// more similar code

Now i want that when I click on radio button, the value of the Evalution column should also change. 现在,我希望当我单击单选按钮时,“评估”列的值也应更改。

Can some body help ? 身体可以帮助吗?

I think that simplest way is call refresh whole table after selecting some button: 我认为最简单的方法是在选择某些按钮后调用刷新整个表:

grid.getView().refresh(false);

But you also need to update your model. 但是您还需要更新模型。 When You click on radio button you may set value to your model like^ 当您单击单选按钮时,您可以为模型设置值,例如^

data.setEvalueation(int selectedRadio);

Or You can create specified ValueProvider to Evaluation column 或者您可以创建指定的ValueProvider到Evaluation列

     ColumnConfig<Data,String> evaluationColumn = new ColumnConfig<Data, String>(new ValueProvider<Data>() {
                @Override
                public String getValue(Data o) {
                    String value = o.getRadioColumnValue();
                    return value;
                }

                @Override
                public void setValue(Data o, Data o2) {

                }

                @Override
                public String getPath() {
                    return "evaluation";
                }
            });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM