0

Add new listitem to current listbox

asked 2011-03-08 07:19:36 +0800

Meko gravatar image Meko
24

I am tring to add new listitem with the same content of previous list items. But it creates new list item only with 1 cell. I am triying to get new added list item (it will be the last item) and change it content.But somehow it's content not the same as others.

						
						<listbox id="listModel" rows="10" mold="paging" pageSize="10" selectedItem="@{mainCtrl.selected}"
							fixedLayout="true" model="@{mainCtrl.model}">
								<listhead>
									<listheader label="${c:l('SYSADM.ManageImportedSubscribers.table.MSISDN')}" sort="auto" />
									<listheader label="${c:l('SYSADM.ManageImportedSubscribers.table.Date')}" sort="auto" />
								    <listheader label="${c:l('SYSADM.ManageImportedSubscribers.table.CO_ID')}" sort="auto" />
								    <listheader label="${c:l('SYSADM.ManageImportedSubscribers.table.Customer_ID')}" sort="auto" />
								      <listheader label="Update ?" sort="auto" />
								</listhead>
								
								
							<listitem   self="@{each=MANAGE_IMPORTED_SET_DATA}"   > 
							
								<listcell> <label value="@{MANAGE_IMPORTED_SET_DATA.MSISDN}" /> <textbox value="@{mainCtrl.copyBean.MSISDN}" visible="false" /> </listcell>
								<listcell><label value="@{MANAGE_IMPORTED_SET_DATA.IMPORT_ID}" /><textbox value="@{mainCtrl.copyBean.IMPORT_ID}"  visible="false" /> </listcell>
								<listcell><label value="@{MANAGE_IMPORTED_SET_DATA.CO_ID}" /><textbox value="@{mainCtrl.copyBean.CO_ID}"  visible="false"  /> </listcell>
								<listcell><label value="@{MANAGE_IMPORTED_SET_DATA.CUSTOMER_ID}"/><textbox value="@{mainCtrl.copyBean.CUSTOMER_ID}"  visible="false"  /> </listcell>
								<listcell><button label="Update"  forward="onClick=onUpdate"/>  
													<button label="Delete"   forward="onClick=onDelete" />  
													<button label="Save"     forward="onClick=onSave" visible="false"/> 
												    <button label="Cancel"   forward="onClick=onCancel"  visible="false"/> 
								</listcell>
								
						</listitem>
										
					</listbox>	


This is where I am creating new list item.

	ManageImportedSet newBean = new ManageImportedSet();
			model.add(newBean);
			binder.loadAll();

			Button addbutton = (Button)event.getOrigin().getTarget();

			Listitem listitem = (Listitem) listModel.getChildren().get(listModel.getVisibleItemCount());
		
			listitem.setParent(listModel);
			
			System.out.println(listitem.getIndex());
			Listcell buttonCell = (Listcell)listitem.getLastChild();
			
			for (int i = 0; i < listitem.getChildren().size(); i++) {
				
				Listcell listcell = (Listcell) listitem.getChildren().get(i);
				((Label) listcell.getChildren().get(0)).setVisible(false);
				((Textbox) listcell.getChildren().get(1)).setVisible(true);
				
			}
			
			for (int i = 0; i < buttonCell.getChildren().size(); i++) {
				
				Button button = (Button) buttonCell.getChildren().get(i);
				
				if (button.isVisible()) {
					
					button.setVisible(false);
				} else {
					button.setVisible(true);
				}
			}
			

delete flag offensive retag edit
Be the first one to reply this discussion!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-03-08 07:19:36 +0800

Seen: 669 times

Last updated: Mar 08 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More