0

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

  • problem is dat i am not able to set the textboxes data to listgridfields. i have tried to put the textboxes data to arraylist n linkedhash map and then set the listgrid "setData" and "setValueMap" option.but listgird is not showing data, only fields is creating in listgrid...thats problem. – Vishal Shrimali Apr 12 '13 at 09:12

1 Answers1

0

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..
}
Maksym Demidas
  • 7,707
  • 1
  • 29
  • 36
  • Yeah i did this thing, but i want to read input data from textboxes and then it wil show in listgrid. i dnt want to hardcode the data in other class file. Arr you getting my point? – Vishal Shrimali Apr 12 '13 at 09:38
  • Hi maksym I have tried your code, everything is going well, Fields are creating in list but it does not showing data in any fields. and the list is also not showing "No item data". Only blank space is showing in each field.. – Vishal Shrimali Apr 12 '13 at 10:58
  • And if i try to show textboxes data to any other labels then it will be showing individually in separate labels. – Vishal Shrimali Apr 12 '13 at 11:04
  • Thanx Maksym.. It is now working perfeclty. I have done some changes in getter and setter method... – Vishal Shrimali Apr 12 '13 at 11:26
  • can you provie me some tutorial links for smartgwt? or any books? – Vishal Shrimali Apr 12 '13 at 13:32
  • See [this](http://stackoverflow.com/questions/11538857/smart-gwt-tutorials-and-guidance#11541189) good answer – Maksym Demidas Apr 12 '13 at 14:07