Hello,

Look into overriding dataTable.newRowItem (..) like this:

protected Item<T> newRowItem(final String id, int index, final IModel<T> model)
    {
        Item<T>item  = new Item<T>(id, index, model);

        item.add (new MyBehaviour(index, model));

    }

Then create a behaviour to implement the action. It could use ajax or javascript that was written out in the page header when it was rendered.

public class MyBehaviour extends AbstractDefaultAjaxBehavior {

    private IModel<T>rowModel;
    private boolean popupVisible = false;

    public MyBehaviour (int index, IModel<T>rowModel) {
        this.rowModel = rowModel;

    }
     // assume you passed trough the model
    protected void onBind() {
getComponent().add(new AttributeModifier ("onmouseover", true, this.getCallbackScript())); getComponent().add(new AttributeModifier ("onmouseout", true, this.getCallbackScript()));

    }

    protected void respond(AjaxRequestTarget target) {

        if (popupVisible) {
            T value = this.rowModel.getObject();
            // show the popup contextualized with T
        }
        else {
            // hide the popup.
        }

    }


}

Depending on what your menu will allow you might not need standard form processing. You could use an AjaxLink to handle the action which would make changes to the IModel<T>rowModel backing object.

Regards,

Mike
Hi,

I have a datatable with a couple of rows. I'd like a menu to popup when the
mouse is located over a row and I'd like it to disappear on "onmouseout".
The menu must be aware of the row model that the mouse cursor is currently
over since I'd like to make changes to the model from the menu.

I'd like to do something similar to the google maps "satellite" button. I.e.
when you move the mouse over it a menu appears allowing you to show or hide
labels on the map.

/Johan


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

Reply via email to