Hi wickers !

I've a problem with wicket and jquery resource rendering.

My webpage has many panels wich uses jquery, and they have javascript attached 
to it. 
This panel-dependant javascript uses jquery, so I render jquery with a 
resourcerefernce in the webpage. 
(The page doesn't use ajax because I want to mantain page stateless and 
bookmarkable.)

The problem is that the javascript attached to panel is rendered first into the 
page, and the jquery reference is the last. 
so, when the page fully renders, i've some 'ReferenceError: $ is not defined' 
errors in webrowser console.

¿ Has anyone experienced similar problems ?


Other little question: wicket6 uses jquery 1.7.2; has anyone tried with 1.8.x ?

Thanks in advance


    > > > Oscar Besga Arcauz  < < < 


PS. 

Example code (little long) --->

public class MyPage extends WebPage {


    public MyPage (PageParameters parameters) {
        super(parameters);
        add(new MyPageJsBehaviour());
        add(new MyPanel("mypanel"));
    }


    private class MyPageJsBehaviour extends Behavior {

            @Override
            public void renderHead(Component component, IHeaderResponse 
response) {                
                
response.render(JavaScriptHeaderItem.forReference(JQueryResourceReference.get(),"jquery"));
                super.renderHead(component,response);
           }
    }

}


public class MyPanel extends Panel {


    public MyPanel(String id,String lang) {
        super(id);
        add(new MyPanelJsBehaviour());
    }

    private class MyPanelJsBehaviour extends Behavior {

            @Override
            public void renderHead(Component component, IHeaderResponse 
response) {
                super.renderHead(component,response);
                response.render(JavaScriptHeaderItem.forReference(new 
JavaScriptResourceReference(MyPanel .class, "MyPanel.js"),"mypaneljs"));
                /**
                //MyPanel.js
                $(function () { // <-- here arises the error, as $ is not 
defined because MyPanel.js is loaded before jquery !!!
                   $('mypanel').dosomething();
                });
                **/
            }
    }

}


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

Reply via email to