You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tom Götz <to...@decoded.de> on 2016/02/17 15:16:18 UTC
click behavior on table rows
Hi there,
I have a DataTable where rows are clickable and open a detail page when clicked. No problem so far.
But: in one column I have a (Bootstrap) dropdown which won’t open any more because the row’s click handler is too greedy and the dropdown won’t receive the click event.
I added the row’s click behavior like that in my DataTable impl:
protected Item<T> newRowItem(String id, int index, IModel<T> model) {
Item<T> item = super(newRowItem(id, index, model);
item.add(new AjaxEventBehavior(„click“) {
@Override
protected void onEvent(AjaxRequestTarget target) {
// ...
}
}
}
Anything I can do about that?
Cheers,
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: click behavior on table rows
Posted by Martin Grigorov <mg...@apache.org>.
Hi Tom,
Option 1) use AjaxCallListener#precondition to check whether the JS event
target is <select> and return false in that case
Option 2) add click listener on the dropdown and suppress event bubbleing
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Wed, Feb 17, 2016 at 3:16 PM, Tom Götz <to...@decoded.de> wrote:
>
> Hi there,
>
> I have a DataTable where rows are clickable and open a detail page when
> clicked. No problem so far.
>
> But: in one column I have a (Bootstrap) dropdown which won’t open any more
> because the row’s click handler is too greedy and the dropdown won’t
> receive the click event.
>
> I added the row’s click behavior like that in my DataTable impl:
>
> protected Item<T> newRowItem(String id, int index, IModel<T> model) {
> Item<T> item = super(newRowItem(id, index, model);
> item.add(new AjaxEventBehavior(„click“) {
> @Override
> protected void onEvent(AjaxRequestTarget target) {
> // ...
> }
> }
> }
>
> Anything I can do about that?
>
> Cheers,
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>