You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by lucast <lu...@hotmail.com> on 2014/11/06 13:28:30 UTC

AjaxFormChoiceComponentUpdatingBehavior for custom CheckGroup and CheckGroupSelector

Dear Forum,

Based on wicket examples, I built a custom CheckGroup with added
CheckGroupSelector.
I also want to add an AjaxFormChoiceComponentUpdatingBehavior() instance to
the CheckGroup to update the items selected. And this is where the problem
lies.

I have extended CheckGroup class to make use of  ICheck jquery plugin
<http://fronteed.com/iCheck/>  .

Because CheckGroupSelector is  "JavaScript sugar" according to a previous
post
<http://apache-wicket.1842946.n4.nabble.com/Wicket-FormTester-not-working-with-CheckGroupSelector-tp4668206p4668217.html>  
(thanks for the reply, Andrea), I had to replace CheckGroupSelector and
AbstractSelector class. For the custom AbstractSelector class, I replaced
the CheckSelector.js to make use of the ICheck functions,
$('#'+checkbox.id).iCheck('check'), $('#'+checkbox.id).iCheck('uncheck'),
etc.

The problem that I have now is that AjaxFormChoiceComponentUpdatingBehavior
no longer picks the "click" event from the checkboxes.
In order to resolve this problem, I am propagating the click event from
inside  CheckSelector.js  using javascript code from  this stackoverflow
answer <http://stackoverflow.com/a/2381862/158499>  . But this still doesn't
solve the problem.

My question is, how can I get AjaxFormChoiceComponentUpdatingBehavior to
pick up any event when I select/unselect any checkboxes from the custom
Icheck solution?

Failing that, how can I best create my own implementation of
AjaxFormChoiceComponentUpdatingBehavior to know when a checkbox has been
clicked?

Sorry for the long post.

Thanks,
Lucas



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormChoiceComponentUpdatingBehavior-for-custom-CheckGroup-and-CheckGroupSelector-tp4668281.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFormChoiceComponentUpdatingBehavior for custom CheckGroup and CheckGroupSelector

Posted by Andrea Del Bene <an...@gmail.com>.
I haven't used this js library, but isn't enough to trigger a click 
event on checkboxes? Like:

$('#'+checkbox.id).iCheck('check');
$('#'+checkbox.id).trigger("click");
> Dear Forum,
>
> Based on wicket examples, I built a custom CheckGroup with added
> CheckGroupSelector.
> I also want to add an AjaxFormChoiceComponentUpdatingBehavior() instance to
> the CheckGroup to update the items selected. And this is where the problem
> lies.
>
> I have extended CheckGroup class to make use of  ICheck jquery plugin
> <http://fronteed.com/iCheck/>  .
>
> Because CheckGroupSelector is  "JavaScript sugar" according to a previous
> post
> <http://apache-wicket.1842946.n4.nabble.com/Wicket-FormTester-not-working-with-CheckGroupSelector-tp4668206p4668217.html>
> (thanks for the reply, Andrea), I had to replace CheckGroupSelector and
> AbstractSelector class. For the custom AbstractSelector class, I replaced
> the CheckSelector.js to make use of the ICheck functions,
> $('#'+checkbox.id).iCheck('check'), $('#'+checkbox.id).iCheck('uncheck'),
> etc.
>
> The problem that I have now is that AjaxFormChoiceComponentUpdatingBehavior
> no longer picks the "click" event from the checkboxes.
> In order to resolve this problem, I am propagating the click event from
> inside  CheckSelector.js  using javascript code from  this stackoverflow
> answer <http://stackoverflow.com/a/2381862/158499>  . But this still doesn't
> solve the problem.
>
> My question is, how can I get AjaxFormChoiceComponentUpdatingBehavior to
> pick up any event when I select/unselect any checkboxes from the custom
> Icheck solution?
>
> Failing that, how can I best create my own implementation of
> AjaxFormChoiceComponentUpdatingBehavior to know when a checkbox has been
> clicked?
>
> Sorry for the long post.
>
> Thanks,
> Lucas
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormChoiceComponentUpdatingBehavior-for-custom-CheckGroup-and-CheckGroupSelector-tp4668281.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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