Question

i have written a code to read the input data from textboxs and then click on submit button, this data will be show in a listgrid. Submit button click event code is here:

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);
   } 
}

how can i set the textboxes data to listgrid fields?

Thanx

Was it helpful?

Solution

Try something like this:

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..
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top