Re: ListView remove a row by SubmitLink always move the last one

2013-06-28 Thread always_rick
Hi Sven, I review my code and api. I misunderstood the
setDefaultFormProcessing( false ). Simply removing that method, then it
works.  Now I am thinking of a way to skip validation, and process form
updating.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659919.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: ListView remove a row by SubmitLink always move the last one

2013-06-28 Thread always_rick
ListPage.html
  
ListPage.java
  
User.java
  

Hi Sven, it is odd. When I was building the quickstart, SubmitLink acts like
removeLink. It was directly copied for the code. I am going to review my
code on weekend. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659905.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: ListView remove a row by SubmitLink always move the last one

2013-06-28 Thread Sven Meier
Sorry, I'm out of ideas. If you can create a quickstart, I'll debug the 
problem.


Sven

On 06/28/2013 12:43 PM, always_rick wrote:

Thank you for quick response.

I tried what you suggested, no luck.

What I think is clicking "remove" link (SubmitLink), form memorizes input
data, then remove row.





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659899.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: ListView remove a row by SubmitLink always move the last one

2013-06-28 Thread always_rick
Thank you for quick response.

I tried what you suggested, no luck.

What I think is clicking "remove" link (SubmitLink), form memorizes input
data, then remove row.





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-delete-the-last-one-tp4659796p4659899.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: ListView remove a row by SubmitLink always move the last one

2013-06-28 Thread Sven Meier
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( "firstName" ) 
);
item.add( new TextField( "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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




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



Re: ListView remove a row by SubmitLink always move the last one

2013-06-28 Thread always_rick
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( "firstName" ) 
);
item.add( new TextField( "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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: ListView remove a row by SubmitLink always move the last one

2013-06-25 Thread Sven Meier

You'll have to show us some code.

Sven

On 06/26/2013 08:33 AM, always_rick wrote:

Hi all,

I have a form of inputs (ListView).

I firstly tried the removeLink, it was working. Because it is a normal link,
it simply don't keep the other rows inputs. Obviously, it does not meet the
requirement. I thought SubmitLink was good, but it always removed the last
row. I clearly see the index is correct, but result is incorrect.

I searched this forum and google, and found the a few answers, none of them
worked in my case.

Could some one please help?


p.s.  I set setReuseItems(true) 'coz wicket api said, "If you nest a
ListView in a Form, always set this property to true, as otherwise
validation will not work properly.", which is correct.






--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-move-the-last-one-tp4659796.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



ListView remove a row by SubmitLink always move the last one

2013-06-25 Thread always_rick
Hi all,

I have a form of inputs (ListView). 

I firstly tried the removeLink, it was working. Because it is a normal link,
it simply don't keep the other rows inputs. Obviously, it does not meet the
requirement. I thought SubmitLink was good, but it always removed the last
row. I clearly see the index is correct, but result is incorrect.

I searched this forum and google, and found the a few answers, none of them
worked in my case.

Could some one please help?


p.s.  I set setReuseItems(true) 'coz wicket api said, "If you nest a
ListView in a Form, always set this property to true, as otherwise
validation will not work properly.", which is correct.






--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-remove-a-row-by-SubmitLink-always-move-the-last-one-tp4659796.html
Sent from the Users forum mailing list archive at Nabble.com.

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