Hi igor, But If I remove setReuseItems(true), it'll remove all field values which user has entered will be removed. Bcz default processing is false for Remove button (Sorry forget to tell you) I just want to remove vehicle2, but the values entered for vehicle1 & vehicle3 should not be lost.
- Pnerkar igor.vaynberg wrote: > > vehicles.setReuseItems(true); <== that is what is causing your list to > reuse old components > > -igor > > > On Jan 31, 2008 5:36 PM, pnerkar <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> Following is my code for rendering vehicle list- >> >> final VehiclesList vehicles = new VehiclesList("vehicledetails", >> ((RatingRequestAuto)getModelObject()).getVehicles()); >> vehicles.setOutputMarkupId(true); >> vehicles.setReuseItems(true); >> add(vehicles); >> >> private static class VehiclesList extends ListView { >> >> >> public VehiclesList (String id, List vehicles) { >> super (id, vehicles); >> >> } >> >> protected void populateItem(final ListItem item) >> { >> >> item.add(new TextField("vehicle.modelText", new >> PropertyModel(vehicle, "model")).setRequired(true)); >> TextField registrationnumber = new >> TextField("vehicle.registrationnumber", new PropertyModel(vehicle, >> "registrationNumber")); >> TextField engineNumber = new >> TextField("vehicle.enginenumber", new >> PropertyModel(vehicle, "engineNumber")); >> >> final int index = item.getIndex(); >> Button remVehBtn = new Button("btn_removeVeh", >> new ResourceModel( >> "removevehicle" )) { >> public void onSubmit() { >> List vehicles = (List) >> getParent().getParent().getModelObject(); >> vehicles.remove(index); >> } >> }); >> } >> } >> >> Thanks a lot for ur reply :) >> >> >> >> >> igor.vaynberg wrote: >> > >> > show us how you populate your listview... >> > >> > -igor >> > >> > >> > On Jan 31, 2008 3:49 PM, pnerkar <[EMAIL PROTECTED]> wrote: >> >> >> >> Hi All, >> >> >> >> I have rendered a list view on a Web Page. >> >> >> >> vehicle1 X >> >> vehicle2 X >> >> vehicle3 X >> >> >> >> when a person click on 'X', that item should be deleted. >> >> But I'm facing an issue, when i click on 'X', last item get deleted. >> >> Actually when I delete vehicle2 from my list, it deletes vehicle2 but >> >> that >> >> component is still there. >> >> So while rendering it render vehicle1 & vehicle2. >> >> >> >> public void onSubmit() { >> >> List vehicles = (List) >> getParent().getParent().getModelObject(); >> >> vehicles.remove(index); >> >> } >> >> >> >> can please help out ?? >> >> >> >> >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/How-to-delete-an-item-from-List-view.-tp15217608p15217608.html >> >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/How-to-delete-an-item-from-List-view.-tp15217608p15218960.html >> >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/How-to-delete-an-item-from-List-view.-tp15217608p15219402.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]