You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "Bob Schellink (JIRA)" <ji...@apache.org> on 2010/07/11 09:59:49 UTC
[jira] Closed: (CLK-637) FormTable setRowList twice does not
display fields correctly
[ https://issues.apache.org/jira/browse/CLK-637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bob Schellink closed CLK-637.
-----------------------------
Resolution: Invalid
> FormTable setRowList twice does not display fields correctly
> ------------------------------------------------------------
>
> Key: CLK-637
> URL: https://issues.apache.org/jira/browse/CLK-637
> Project: Click
> Issue Type: Bug
> Components: extras
> Affects Versions: 2.1.0
> Reporter: Huy Do
>
> 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++) {
> data.add(new DataRow(false, "Item" + i, "code" + i));
> }
> return data;
> }
>
> public List getRowList2() {
> List data = new ArrayList();
> for (int i=0; i<10; i++) {
> if (i % 2 == 0) {
> data.add(new DataRow(true, "Item" + i, "code" + i));
> }
> }
> for (int i=0; i<10; i++) {
> if (i % 2 != 0) {
> data.add(new DataRow(false, "Item" + i, "code" + i));
> }
> }
> 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) {
> this.selected = selected;
> this.description = description;
> this.code = 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;
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.