You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by dlock <dl...@gmacsoftware.com> on 2013/11/28 14:03:42 UTC

OnChangeAjaxBehavior continually triggered

I have a DataTable with a single column.  The table has a toolbar assigned
which provides sorting and filtering.

The filtering is done via TextField that has the following
OnChangeAjaxBehavior assigned.


OnChangeAjaxBehavior onChangeAjaxBehavior = new OnChangeAjaxBehavior()
{
    @Override
    protected void onUpdate(AjaxRequestTarget target)
    {
         FilteredLazyLoadingDataProvider<T, S> provider =
             (FilteredLazyLoadingDataProvider<T, S>)
dataTable.getDataProvider();
         provider.filter(FilterAjaxFallbackOrderByBorder.this);
                    
         target.add(dataTable);
         target.appendJavaScript("moveCaretToEnd(document.getElementById('"
+ m_filter.getMarkupId() + "'))");
    }
                
    @Override
    protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
    {
         super.updateAjaxAttributes(attributes);
         attributes.setThrottlingSettings(new ThrottlingSettings(id,
Duration.milliseconds(200), true));
     }
};

When I view a page in Chrome/Firefox everything works as expected.  When I
view the page in Internet Explorer 11 I observer the following issue.

If the filter textfield has focus and is empty, the
OnChangeAjaxBehavior.onUpdate method is continually called (ajax requests
spam the server).  As soon as I enter a value into the text field, the
filtering is performed and the ajax calls cease to spam the server.

What is interesting is if I create a simple form with just a textfield in
and assign the above OnChangeAjaxBehaviour, the textfield in the form does
not have the same issue as the one in the table header.

My app is deployed in Tomcat 7.0.30 (although the issue can also been seen
when testing via jetty) 
Wicket 6.12

I have created a quickstart that can be run to observe the issue if anyone
is interested (what is the best way to provide it?)

I would appreciate if anyone can give me some pointers as to what is going
on.





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/OnChangeAjaxBehavior-continually-triggered-tp4662704.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: OnChangeAjaxBehavior continually triggered

Posted by dlock <dl...@gmacsoftware.com>.
Hi Martin.

Thanks for the quick reply.  I have created the following ticket...

https://issues.apache.org/jira/browse/WICKET-5432





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/OnChangeAjaxBehavior-continually-triggered-tp4662704p4662706.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: OnChangeAjaxBehavior continually triggered

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Thu, Nov 28, 2013 at 3:03 PM, dlock <dl...@gmacsoftware.com> wrote:

> I have a DataTable with a single column.  The table has a toolbar assigned
> which provides sorting and filtering.
>
> The filtering is done via TextField that has the following
> OnChangeAjaxBehavior assigned.
>
>
> OnChangeAjaxBehavior onChangeAjaxBehavior = new OnChangeAjaxBehavior()
> {
>     @Override
>     protected void onUpdate(AjaxRequestTarget target)
>     {
>          FilteredLazyLoadingDataProvider<T, S> provider =
>              (FilteredLazyLoadingDataProvider<T, S>)
> dataTable.getDataProvider();
>          provider.filter(FilterAjaxFallbackOrderByBorder.this);
>
>          target.add(dataTable);
>          target.appendJavaScript("moveCaretToEnd(document.getElementById('"
> + m_filter.getMarkupId() + "'))");
>     }
>
>     @Override
>     protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
>     {
>          super.updateAjaxAttributes(attributes);
>          attributes.setThrottlingSettings(new ThrottlingSettings(id,
> Duration.milliseconds(200), true));
>      }
> };
>
> When I view a page in Chrome/Firefox everything works as expected.  When I
> view the page in Internet Explorer 11 I observer the following issue.
>
> If the filter textfield has focus and is empty, the
> OnChangeAjaxBehavior.onUpdate method is continually called (ajax requests
> spam the server).  As soon as I enter a value into the text field, the
> filtering is performed and the ajax calls cease to spam the server.
>
> What is interesting is if I create a simple form with just a textfield in
> and assign the above OnChangeAjaxBehaviour, the textfield in the form does
> not have the same issue as the one in the table header.
>
> My app is deployed in Tomcat 7.0.30 (although the issue can also been seen
> when testing via jetty)
> Wicket 6.12
>
> I have created a quickstart that can be run to observe the issue if anyone
> is interested (what is the best way to provide it?)
>

The best is to attach it to a ticket in Jira -
https://issues.apache.org/jira/browse/WICKET

And the reason for the problem is at
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js?source=c#L2620

I guess IE 11 finally implements 'oninput' event for text inputs. This is
OK, we have to improve our #isIE() method to count IE 11 as evergreen
browser.
But it seems they broke somehow the other event listeners ...


>
> I would appreciate if anyone can give me some pointers as to what is going
> on.
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/OnChangeAjaxBehavior-continually-triggered-tp4662704.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
>
>