读取输入数据并在SmartGwt中的listgrid中显示数据

时间:2013-04-12 07:33:18

标签: gwt textbox smartgwt listgrid

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

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字段?

感谢名单

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

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..
}