wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Meier <s...@meiers.net>
Subject Re: ListView remove a row by SubmitLink always move the last one
Date Fri, 28 Jun 2013 10:05:09 GMT
First of all don't pull something out of a model and put it into another 
model:

    item.setDefaultModel(new CompoundPropertyModel( 
item.getModelObject() ) );

Do this instead:

    item.setDefaultModel(new CompoundPropertyModel( item.getModel() ) );

Perhaps this is the reason: the textfields are showing stale data.

Sven


On 06/28/2013 11:20 AM, always_rick wrote:
> Sven, I forgot.
>
> code:
> -----
> ListView listView = new ListView( "users", users ) {
>
> 			@Override
> 			protected void populateItem( final ListItem item ) {
> 				item.setDefaultModel(
> 						new CompoundPropertyModel( item.getModelObject() ) );
> 				item.add( new TextField<String>( "firstName" ) );
> 				item.add( new TextField<String>( "lastName" ) );
>
> 				item.add( //removeLink( "remove", item ) );
> 					      new SubmitLink( "remove", item.getModel() ) {
> 							private static final long serialVersionUID = 1L;
>
> 					@Override
> 					public void onSubmit() {
> 						// copy from ListView > removeLink
> 						addStateChange();
> 						item.modelChanging();
> 						getList().remove( item.getIndex() );
> 						modelChanged();
> 						removeAll();
> 					}
> 				}.setDefaultFormProcessing( false ) );
> 			}
> }
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659895.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message