Hello Martin,
I solved my problem 5 minutes ago. I haven’t seen your mail because I was
working hard to find the source of this behaviour.
The solution was to use AjaxFormComponentUpdatingBehavior with event type
"input" instead of OnChangeAjaxBehavior.
Martin wrote:
> How do you trigger the update in this case? with "unfocused text field"
>
> I don't see any reason why Wicket will deliver out of date information
like
> this.
For example: I entered 3 charaters into the text field which sent out one
post request each. Each of those post requests got an Ajax response with
correct table text and old event registrations of the table’s AjaxLinks.
When the text field then lost its focus because of clicking somewhere on
the page or into Firefox developer tools the browser sent out a fourth post
request which got correct event registrations.
After I switched to AjaxFormComponentUpdatingBehavior everything was fine.
...
I looked into the source code of OnChangeAjaxBehaviour. What it does is to
use the event type "onchange". Also it adds a change handler to the reponse:
response.write("new Wicket.ChangeHandler('" + id + "');");
This change handler maybe fires on change and blur. Maybe I had problems
with AjaxLinks inside a refreshed table because of some kind of race
condition.
Let me know if you still want to see this as a quickstart.
Thanks,
Marcus
Martin Grigorov <[email protected]> schrieb am Di., 5. Mai 2015 um
16:53 Uhr:
> Hi,
>
> On Tue, May 5, 2015 at 2:20 PM, Marcus Husar <[email protected]>
> wrote:
>
> > Hello,
> >
> > I have two AjaxLinks inside a panel which is inside an IColumn of a
> > DataTable. The table is refreshed by a TextField which implements an
> > OnChangeAjaxBehavior. This behaviour manipulates the data provider and
> adds
> > the table to the target.
> >
> > When text is entered to the text field the table is filtered as expected.
> > But the response body of the Ajax post request delivers event
> registrations
> > of the AjaxLinks rendered in the iteration before.
> >
> > E.g.: IBehaviourlisteners for AjaxLink IDs id54 and id55 are delivered.
> But
> > the links have the IDs id56 and id57.
> >
> > Example:
> >
> > <div>
> > <a id="id56" href="javascript:;">Edit</a>
> > <a id="id57" href="javascript:;">Delete</a>
> > </div>
> >
> > ...
> >
> >
> <evaluate><![CDATA[(function(){Wicket.Ajax.ajax({"c":"id54","u":"./SiglumIndexPage?4-1.IBehaviorListener.0-container-fragment-siglumDataTable-body-rows-26-cells-3-cell-editLink","e":"click"});})();(function(){Wicket.Ajax.ajax({"c":"id55","u":"./SiglumIndexPage?4-1.IBehaviorListener.0-container-fragment-siglumDataTable-body-rows-26-cells-3-cell-deleteLink","e":"click"});})();]]></evaluate></ajax-response>
> >
> > If I unfocus the text field I get a response with the correct event
> > registrations.
> >
>
> How do you trigger the update in this case? with "unfocused text field"
>
> I don't see any reason why Wicket will deliver out of date information like
> this.
> If you can reproduce this in a quickstart then please attach it to a ticket
> in JIRA and we will take a look.
>
>
> > ...
> >
> >
> <evaluate><![CDATA[(function(){Wicket.Ajax.ajax({"c":"id56","u":"./SiglumIndexPage?4-1.IBehaviorListener.0-container-fragment-siglumDataTable-body-rows-27-cells-3-cell-editLink","e":"click"});})();(function(){Wicket.Ajax.ajax({"c":"id57","u":"./SiglumIndexPage?4-1.IBehaviorListener.0-container-fragment-siglumDataTable-body-rows-27-cells-3-cell-deleteLink","e":"click"});})();]]></evaluate></ajax-response>
> >
> > Has anyone seen similar problems? Is it possible enforce an event
> > registration refresh for AjaxLinks?
> >
> > Just ask for code examples if needed.
> >
> > Regards,
> > Marcus
> >
>