Populating ListGridFields in smartgwt
This is my code snippet:
final ListGrid subscriberGrid = new ListGrid();
subscriberGrid.setWidth(500);
subscriberGrid.setHeight(224);
subscriberGrid.setShowAllRecords(true);
subscriberGrid.setSelectionType(SelectionStyle.SIMPLE);
开发者_如何学Python subscriberGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
ListGridField fnField = new ListGridField("fn", "First Name");
ListGridField lnField = new ListGridField("ln", "Last Name");
ListGridField emailField = new ListGridField("email", "E-mail");
subscriberGrid.setFields(fnField, lnField, emailField);
How do I enter values for it? I tried initiating a ListGridRecord[], but I was unable to fill any values properly. I also tried with a Javascript Object, but that also gave me an error. Googling also did not return satisfactory results.
TIA.
ahh Darn. I got the answer after asking it.
ListGridRecord temp = new ListGridRecord();
temp.setAttribute("fn", "foo");
temp.setAttribute("ln", "bar");
temp.setAttribute("email", "baz");
ListGridRecord[] record = { temp };
subscriberGrid.setData(record);
Sorry for the clutter ^-^
精彩评论