Hi Sven & all,

I would also like to get a callback for the cancel button. 

I tried following adjustment, but in this case the #onUpdate(AjaxRequestTarget 
target) method is called multiple times and in the end, all stars are 
colored/enabled (instead of all stars greyed out).

response.render(OnDomReadyHeaderItem.forScript(String.format("$('%s').rating({ 
callback: function(value, link) {      if (typeof $(this).attr('id') == 
'undefined') {$('%s').trigger('click');} else {$(this).trigger('click');} 
}});", selector, selector)));

When the cancel rating link is clicked the id is undefined. I cannot make a JS 
click event on this div, maybe as it is added later via the JS?
http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button
 
<http://stackoverflow.com/questions/1551102/jquery-star-rating-plugin-and-cancel-rating-button>

thanks a lot,
Chris




> Am 19.04.2015 um 15:26 schrieb Chris <chris...@gmx.at>:
> 
> Sven, you are great!
> 
> Your solution works perfect.
> 
> Thanks a lot for your help!!
> Chris
> 
>> Am 19.04.2015 um 11:55 schrieb Sven Meier <s...@meiers.net>:
>> 
>> Hi Chris,
>> 
>> I've opened a pull request.
>> 
>> Hope this helps
>> Sven
>> 
>> 
>> On 19.04.2015 02:43, Chris wrote:
>>> Hi Sven & all,
>>> 
>>> when using the JS Star Rating plugin 
>>> (https://www.fyneworks.com/jquery/star-rating 
>>> <https://www.fyneworks.com/jquery/star-rating>, star images instead of 
>>> radio boxes), the #AjaxFormChoicecomponentUpdatingBehaviour does not work 
>>> anymore.
>>> 
>>> I have created a sample project based on the wicket-example 
>>> „RadioGroupPage“ and put it here: https://github.com/cat1000/StarRating 
>>> <https://github.com/cat1000/StarRating>
>>> 
>>> It would be great if someone could have a look the conflict.
>>> 
>>> Thanks a lot,
>>> Chris
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> Am 18.04.2015 um 23:43 schrieb Chris <chris...@gmx.at>:
>>>> 
>>>> Hi Sven,
>>>> 
>>>> have you added the AjaxFormChoicecomponentUpdatingBehaviour in this 
>>>> example to the group?
>>>> 
>>>> group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
>>>>           protected void onUpdate(AjaxRequestTarget target) {
>>>>       // Ajax actions here
>>>>       System.out.println("The selected value is " + 
>>>> getComponent().getDefaultModelObjectAsString());
>>>>   }
>>>> });
>>>> 
>>>> Thanks, Chris
>>>> 
>>>>> Am 18.04.2015 um 13:24 schrieb Sven Meier <s...@meiers.net>:
>>>>> 
>>>>> Looks good.
>>>>> 
>>>>> I've just added an AjaxFormChoiceComponentUpdatingBehavior to 
>>>>> wicket-examples' RadioGroupPage and it worked as expected.
>>>>> 
>>>>> Which Wicket version? Can you create a quickstart?
>>>>> 
>>>>> Have fun
>>>>> Sven
>>>>> 
>>>>> On 18.04.2015 13:19, Chris wrote:
>>>>>> The html is as follows:
>>>>>> 
>>>>>> <wicket:panel>
>>>>>>   <form wicket:id="form" class="form">
>>>>>>      <div class="rating" wicket:id="group">
>>>>>>             <input wicket:id="radio1" type="radio"/>
>>>>>>        <input wicket:id="radio2" type="radio"/>
>>>>>>             ...
>>>>>>      </div>
>>>>>>   </form>
>>>>>> </wicket:panel>
>>>>>> 
>>>>>> best regards, Chris
>>>>>> 
>>>>>> 
>>>>>>> Am 18.04.2015 um 13:14 schrieb Chris <chris...@gmx.at>:
>>>>>>> 
>>>>>>> Hi Sven,
>>>>>>> 
>>>>>>> the form is added to a panel.
>>>>>>> 
>>>>>>> Chris
>>>>>>> 
>>>>>>> 
>>>>>>>> Am 18.04.2015 um 11:26 schrieb Sven Meier <s...@meiers.net>:
>>>>>>>> 
>>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> is your RadioGroup is bound to <wicket:container> in your markup?
>>>>>>>> 
>>>>>>>> Sven
>>>>>>>> 
>>>>>>>> On 18.04.2015 07:00, Chris wrote:
>>>>>>>>> Hi all,
>>>>>>>>> 
>>>>>>>>> I have a radio group with different radio choices and I would like to 
>>>>>>>>> add ajax behavior to the group.
>>>>>>>>> With the method #AjaxFormChoiceComponentUpdatingBehavior, the 
>>>>>>>>> #onUpdate is never called currently.
>>>>>>>>> 
>>>>>>>>> How to fix this?
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Form form = new Form("form");
>>>>>>>>> RadioGroup<RadioChoice> radioGroup = new 
>>>>>>>>> RadioGroup<RadioChoice>("group", new Model<RadioChoice>() {...}
>>>>>>>>> 
>>>>>>>>> Radio<RadioChoice> radio1 = new Radio<RadioChoice>("radio1", new 
>>>>>>>>> Model<RadioChoice>(1));
>>>>>>>>> Radio<RadioChoice> radio2 = new Radio<RadioChoice>("radio2", new 
>>>>>>>>> Model<RadioChoice>(2));
>>>>>>>>> radioGroup.add(radio1);
>>>>>>>>> radioGroupd.add(Radio2);
>>>>>>>>> 
>>>>>>>>> form.add(radioGroup);
>>>>>>>>> 
>>>>>>>>> radioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
>>>>>>>>>          protected void onUpdate(AjaxRequestTarget target) {
>>>>>>>>>              // Ajax actions here
>>>>>>>>>          }
>>>>>>>>> });
>>>>>>>>> 
>>>>>>>>> Thanks, Chris
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>>>> 
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>> 
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

Reply via email to