【问题标题】:Read the input data and show the data in listgrid in SmartGwt读取输入数据并在 SmartGwt 中的 listgrid 中显示数据
【发布时间】:2013-04-12 07:33:17
【问题描述】:

我编写了一个代码来从文本框中读取输入数据,然后单击提交按钮,此数据将显示在列表网格中。 提交按钮点击事件代码在这里:

public void onClick(ClickEvent event) {sendInfoToSever();}
private void sendInfoToSever() {
            String Ename=firstName.getText();
            String Eemail=Email.getText();
            String Equerytype=rgi.getDisplayValue();
            String Edesignation1=check1.getFormValue();
            String Edesignation2=check2.getFormValue();
            String Econtact=Contact.getText();

            int indx=li1.getSelectedIndex();
            String Ecountry=li1.getValue(indx);
            String Equerytext=queryText.getText();
            showData.setWidth(475);
            showData.setHeight(100);

            ListGridField Lname= new ListGridField("name", "Name");
            ListGridField Lemail= new ListGridField("email", "Email");
            ListGridField Lquerytype= new ListGridField("Query Type");
            ListGridField Ldesignation1= new     ListGridField("Designation");
            ListGridField Ldesignation2= new     ListGridField("Designation");
            ListGridField Lcontact= new ListGridField("Contact");
            ListGridField Lcountry= new ListGridField("Country");
            ListGridField Lquerytext= new ListGridField("Query Text");
            showData.setFields(Lname,Lemail, Lquerytype, Ldesignation1, Ldesignation2, Lcontact, Lcountry, Lquerytext);
   } 
}

如何将文本框数据设置为 listgrid 字段?

感谢

【问题讨论】:

  • 问题是我无法将文本框数据设置为 listgridfields。我试图将文本框数据放入arraylist n linkedhash map,然后设置listgrid“setData”和“setValueMap”选项。但listgird没有显示数据,只有字段在listgrid中创建......这就是问题。

标签: gwt textbox smartgwt listgrid


【解决方案1】:

试试这样的:

YourCustomRecordObject[] data = new YourCustomRecordObject[]{  
                new YourCustomRecordObject(firstName.getText(), Email.getText(), ..all other fields.. )
};
showData.setData(data);

public class YourCustomRecordObject {

    public String name;
    public String email;
    .. all other fields..

    public YourCustomRecordObject(String name, String email, ..all other fields..) {
        this.name = name;
        this.email = emal;
        .......
    }

    .. getters and setters..
}

【讨论】:

  • 是的,我做了这件事,但我想从文本框中读取输入数据,然后它将显示在 listgrid 中。我不想硬编码其他类文件中的数据。你明白我的意思吗?
  • 嗨 maksym 我已经尝试过你的代码,一切顺利,字段正在列表中创建,但它没有显示任何字段中的数据。并且列表也没有显示“无项目数据”。每个字段中只显示空格..
  • 如果我尝试向任何其他标签显示文本框数据,那么它将在单独的标签中单独显示。
  • Thanx Maksym.. 它现在运行良好。我对 getter 和 setter 方法做了一些更改...
  • 你能给我一些 smartgwt 的教程链接吗?还是什么书?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-11
相关资源
最近更新 更多