click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Huy Do (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CLK-637) FormTable setRowList twice does not display fields correctly
Date Thu, 04 Mar 2010 04:43:27 GMT

    [ https://issues.apache.org/jira/browse/CLK-637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841058#action_12841058
] 

Huy Do commented on CLK-637:
----------------------------

Hi Malcolm,

Thanks for the pointers.

I will try and understand it further and post a question on the mailing 
list.

Sorry for polluting the bugs list.

Regards,

Huy




> 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.


Mime
View raw message