Monday, January 21, 2008

Edit functionality for the rows of a DataView

Description
How can I implement the edit functionality over the whole row(s) of a DataView component?

Solution
JAVA
Add following code snippet in the implementet Method void populateItem(Item item) of the DataView component:

item.add(new AjaxEventBehavior("onclick") {
protected void onEvent(AjaxRequestTarget target) {
// action
}
});


Through this piece of code the action is called by each onclick event on the whole row.


HTML
Additionaly you can define the hand cursor of the row TR-tags:

<tr wicket:id="data" style="cursor: hand;">

No comments: