Hello,

we had a problem with JQueryBehaviour overwriting the JQuery.js on ajaxcalls
and thus deleting references to JQuery objects.
In our app, we have a JQuery Datepicker and some ajax loaded dropdowns with
an attached JQuerybehaviour. Thus, when a dropdown was refreshed via ajax,
the JQuery.js was send in the renderHead method of JQuerybehaviour.
Though our datepicker, which was referencing a JQuery object, lost this
reference when the lib was included in the head.

Our solution is the following: We track whether the lib has already been
included using a MetaDataKey 

@SuppressWarnings("serial")
public class BasicJQueryBehavior extends JQueryBehavior 
{
        /**
         * Methode wurde überschrieben weil die Methode von
<code>JQueryBehavior</code>
         * ineffizient war.
         */
        @Override
        public boolean getIncludeJQueryJS(IHeaderResponse response) 
        {
        final Page page=getComponent().getPage();
        return page.getMetaData(KEY_JQUERYINCLUDED)==null;
        }
        
    @Override
    public void renderHead(IHeaderResponse response) 
    {
        super.renderHead(response);           
        getComponent().getPage().setMetaData(KEY_JQUERYINCLUDED,Boolean.TRUE);
    }

    private static final MetaDataKey KEY_JQUERYINCLUDED=new
MetaDataKey(Boolean.class)
        {
                /**
                 * 
                 */
                private static final long serialVersionUID = 
8009276756129719518L;              
        };
}
-- 
View this message in context: 
http://www.nabble.com/JQueryBehaviour-overwriting-JQuery.js-on-ajaxcall-tp16143968p16143968.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to