Re: ListView + dynamic rows: always remove last row...

2010-06-19 Thread jOki

Even Im trying to implement the remove link as:

 - item.add(removeLink(removeKeyword, item));

and it doesnt work... always remove the last row...


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-dynamic-rows-always-remove-last-row-tp2260480p2261045.html
Sent from the Wicket - User 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 + dynamic rows: always remove last row...

2010-06-19 Thread jOki

Hi,

I tried with/without setReuseItems and the behaviour is the same.

I think you can be right with equals/hashcode not being implemented
correctly...

I tried another time with a ListString with different values and its
working...

I tried as well to implement these methods (equals/hashcode) in my code but
it doesnt work.

How can I differentiate objects even if when they are added (they are
textfields) they just have empty values

Thanks for the help!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-dynamic-rows-always-remove-last-row-tp2260480p2261292.html
Sent from the Wicket - User 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



ListView + dynamic rows: always remove last row...

2010-06-18 Thread jOki

Hi!!

Im trying to implement a dynamic Form, where you can add textfields and
remove as you want. The add button works fine, but the remove button always
remove the last testfield and not the selected field. For example:

Textfield1 add remove
Textfield2 add remove
Textfield3 add remove

click on remove (row textfield2) and Textfield3 is removed. It should remove
Textfield2, doesnt it?


Some code:

public class KeywordObject implements Serializable {
private static final long serialVersionUID = 1L;
private String keyword;
   
public void setKeyword(String keyword) {
this.keyword = keyword;
}

public String getKeyword() {
return this.keyword;
}
}

And in the form...

ListKeywordObject keyList = new ArrayListKeywordObject();
keyList.add(new KeywordObject());

final ListView keywordView = new ListView(keywordView, keyList) {

@Override
protected void populateItem(final ListItem item) {
KeywordObject model = (KeywordObject)
item.getModelObject();
item.add(new TextField(keyword, new
PropertyModel(model, keyword)));

// keyword add link
Link addKeyword = new Link(addKeyword,
item.getModel()) {

@Override
public void onClick() {
keyList.add(new KeywordObject());
}
};

// keyword remove link
Link removeKeyword = new Link(removeKeyword,
item.getModel()) {

@Override
public void onClick() {
KeywordObject selected = (KeywordObject)
getModelObject();
keyList.remove(selected);
}
};

item.add(addKeyword);
item.add(removeKeyword);
}
};

add(keywordView);
keywordView.setReuseItems(true);


Im getting crazy about that...

Thanks.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-dynamic-rows-always-remove-last-row-tp2260480p2260480.html
Sent from the Wicket - User 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