Hi Martin, 

Thanks for your post, in the end I found this post on thewicketevangelist //
Jeff Schwartz who doesn't post so much any more (I think he has switched
from wicket to node js), which is a shame as his blog is really instructive: 

http://thewicketevangelist.blogspot.com.es/2011/12/reusable-jquery-ui-autocomplete-wicket.html
<http://thewicketevangelist.blogspot.com.es/2011/12/reusable-jquery-ui-autocomplete-wicket.html>
  

Anyway what I did was add the widget as a AbstractAjaxBehavior and implement
the renderHead(Component, IHeaderResonse) and onRequest() methods. 

For anyone interested the implementations where along the lines of: 
   @Override   public void renderHead(Component _component, IHeaderResponse
_response) {      super.renderHead(_component, response);     
renderHeaderJs(_response, JS_BOOTSTRAP);      ... more rendering of other js
files ...      Map<String, String> variables = new HashMap<String,
String>();      variables.put("jsCurrenciesArray", getJsCurrenciesArray());     
... more interpolated variables ...      variables.put("callbackUrl",
getCallbackUrl().toString());      TextTemplate packageTextTemplate = new
PackageTextTemplate(MyJqueryWidgetBehavior.class, JS_INIT);     
packageTextTemplate.interpolate(variables);     
_response.renderOnDomReadyJavaScript(packageTextTemplate.asString());   }  
private void renderHeaderJs(IHeaderResponse _response, String
_inPackageJsFile) {      if (!_response.wasRendered(_inPackageJsFile)) {        
_response.renderJavaScriptReference(new
PackageResourceReference(JqueryRealtyAdvertSideFilter.class,              
_inPackageJsFile));         _response.markRendered(_inPackageJsFile);      }  
}   @Override   public void onRequest() {      RequestCycle requestCycle =
RequestCycle.get();      Request request = requestCycle.getRequest();     
IRequestParameters irp = request.getRequestParameters();      // construct
the filter to be run against the mw from the parameters in the ajax
request...      Filter filter = getFilterFromParameters(irp);      // run
the filter using the injected manager (      // check out
getBehaviorInstantiationListeners().add(wicketGuiceInjector); in the
Application class      realtyAdvertManager.runFilter(filter);      // create
a model from the results of the filter      ListModel realtyAdvertModel =
new ListModel(filter.getBeans());      // use the model to create a results
panel      FilterResults newResults = new FilterResults("results",
realtyAdvertModel);     // replace the model in the component heirarchy     
Component oldResults = getComponent().get("results");     
oldResults.replaceWith(newResults);     // write it out to the request so
that it blats over the original results panel     
requestCycle.scheduleRequestHandlerAfterCurrent(new
ComponentRenderingRequestHandler(newResults));   }

Anyway thanks to Jeff Schwartz for his original blog post.  And thank you
Martin for taking the time to post another solution.
Cheers
SimonSimon



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wire-legacy-ajax-jquery-widget-to-Wicket-page-tp4652684p4652797.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to