Hi,
I'm quite new Wicket and JavaScript. I just started with a small project
to get my hands on Wicket. I'm trying to use an JQuery Selector. I used
this JQuery Example:
http://jqueryui.com/selectable/#serialize
I wrote an SelectableBeavior and added it to an WebMarkupContainer. But
I don't understand how to implement the callback from JavaSript. Now, on
clicking on my Selector, Firebug tells me "TypeError: Wicket.Ajax is
undefined"
That's my current example:
public class MySelectorPanel extends Panel {
public MySelectorPanel(String id, List<String> items) {
super(id);
ListView<String> listAjaxView = new ListView<String>(
"listAjaxView", items) {
@Override
protected void populateItem(ListItem<String> i) {
i.add(new Label("itemLabel",
i.getModelObject()));
i.setOutputMarkupId(true);
}
};
WebMarkupContainer listContainer = new WebMarkupContainer(
"selectable");
listContainer.setOutputMarkupId(true);
listContainer.setMarkupId("selectable");
listContainer.add(listAjaxView);
SelectableBehavior b = new SelectableBehavior();
listContainer.add(b);
add(listContainer);
}
private class SelectableBehavior extends AbstractAjaxBehavior {
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
String js = " $(document).ready(function() { $('#"
+ component.getMarkupId()
+ "').selectable({"
+ "stop: function() {"
+ "$( \".ui-selected\", this ).each(function() {"
+ "var index = $( '#"+component.getMarkupId()+" li' ).index(
this );"
+ "Wicket.Ajax.get({\"u\":\""+ getCallbackUrl()+"\"});"
+ "});"
+ "}"
+"}); "
+"});";
response.render(OnDomReadyHeaderItem
.forScript(js));
}
@Override
public void onRequest() {
}
}
}
Do you hava any hints or Links to docs for me?
Kind regards
Volker
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org