Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
2.1.0
-
None
-
None
Description
See following code. onPost, the table does not display the "code" field on the correct row as it's corresponding "description" field.
This only happens if you setRowList once, then setRowList again in the one request.
public class TestPage extends Page {
public String msg;
public FormTable table = new FormTable();
public void onInit()
{ super.onInit(); table.setSortable(false); table.setClass(Table.CLASS_SIMPLE); table.getForm().setButtonAlign(Form.ALIGN_RIGHT); table.addColumn(new FieldColumn("selected", "Select", new Checkbox())); table.addColumn(new Column("description")); TextField ledgerCodeField = new TextField(); ledgerCodeField.setSize(22); table.addColumn(new FieldColumn("code", "Code", ledgerCodeField)); table.setRowList(getRowList1()); table.getForm().add(new Submit("ok", " OK ")); }
public List getRowList1() {
List data = new ArrayList();
for (int i=0; i<10; i++)
return data;
}
public List getRowList2() {
List data = new ArrayList();
for (int i=0; i<10; i++) {
if (i % 2 == 0)
}
for (int i=0; i<10; i++) {
if (i % 2 != 0)
}
return data;
}
public void onPost() {
boolean valid = true;
if (table.getForm().isValid())
{ table.getRowList().clear(); table.setRowList(getRowList2()); }}
}
public class DataRow {
boolean selected = false;
String description = "";
String code = "";
public DataRow() {
}
public DataRow(boolean selected, String description, String code)
public boolean isSelected()
{ return selected; }public void setSelected(boolean selected)
{ this.selected = selected; }public String getDescription()
{ return description; }public void setDescription(String description)
{ this.description = description; }public String getCode()
{ return code; }public void setCode(String code)
{ this.code = code; }}