Example usage for org.apache.wicket.request.http WebRequest PARAM_AJAX_BASE_URL

List of usage examples for org.apache.wicket.request.http WebRequest PARAM_AJAX_BASE_URL

Introduction

In this page you can find the example usage for org.apache.wicket.request.http WebRequest PARAM_AJAX_BASE_URL.

Prototype

String PARAM_AJAX_BASE_URL

To view the source code for org.apache.wicket.request.http WebRequest PARAM_AJAX_BASE_URL.

Click Source Link

Document

marker for Ajax-relative url

Usage

From source file:com.mylab.wicket.jpa.ui.pages.select2.AbstractSelect2Choice.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    // configure the ajax callbacks
    if (isAjax()) {
        AjaxSettings ajax = getSettings().getAjax(true);
        ajax.setData(String.format(
                "function(params) { return { q: params.term, page: params.page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }",
                WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL));
        ajax.setProcessResults("function(data, page) { return { results: data.items };  }");
    }//from   ww  w  .j a  va  2  s  . co  m
    // configure the localized strings/renderers
    getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");
    getSettings().setFormatInputTooShort("function(input, min) { return min - input.length == 1 ? '"
            + getEscapedJsString("inputTooShortSingular") + "' : '" + getEscapedJsString("inputTooShortPlural")
            + "'.replace('{number}', min - input.length); }");
    getSettings().setFormatSelectionTooBig(
            "function(limit) { return limit == 1 ? '" + getEscapedJsString("selectionTooBigSingular") + "' : '"
                    + getEscapedJsString("selectionTooBigPlural") + "'.replace('{limit}', limit); }");
    getSettings().setFormatLoadMore("function() { return '" + getEscapedJsString("loadMore") + "';}");
    getSettings().setFormatSearching("function() { return '" + getEscapedJsString("searching") + "';}");
}

From source file:com.vaynberg.wicket.select2.AbstractSelect2Choice.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    // configure the ajax callbacks

    AjaxSettings ajax = settings.getAjax(true);

    ajax.setData(String.format(/*  w w w. j a  va  2  s  .  co  m*/
            "function(term, page) { return { term: term, page:page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }",
            WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL));

    ajax.setResults("function(data, page) { return data; }");

    // configure the localized strings/renderers
    getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");
    getSettings().setFormatInputTooShort("function(input, min) { return min - input.length == 1 ? '"
            + getEscapedJsString("inputTooShortSingular") + "' : '" + getEscapedJsString("inputTooShortPlural")
            + "'.replace('{number}', min - input.length); }");
    getSettings().setFormatSelectionTooBig(
            "function(limit) { return limit == 1 ? '" + getEscapedJsString("selectionTooBigSingular") + "' : '"
                    + getEscapedJsString("selectionTooBigPlural") + "'.replace('{limit}', limit); }");
    getSettings().setFormatLoadMore("function() { return '" + getEscapedJsString("loadMore") + "';}");
    getSettings().setFormatSearching("function() { return '" + getEscapedJsString("searching") + "';}");
}

From source file:org.wicketstuff.select2.AbstractSelect2Choice.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    // configure the ajax callbacks
    if (isAjax()) {
        AjaxSettings ajax = settings.getAjax(true);
        ajax.setData(String.format(
                "function(term, page) { return { term: term, page:page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }",
                WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL));
        ajax.setResults("function(data, page) { return data; }");
    }//from w w w. ja  v a 2 s .c  om
    // configure the localized strings/renderers
    getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");
    getSettings().setFormatInputTooShort("function(input, min) { return min - input.length == 1 ? '"
            + getEscapedJsString("inputTooShortSingular") + "' : '" + getEscapedJsString("inputTooShortPlural")
            + "'.replace('{number}', min - input.length); }");
    getSettings().setFormatSelectionTooBig(
            "function(limit) { return limit == 1 ? '" + getEscapedJsString("selectionTooBigSingular") + "' : '"
                    + getEscapedJsString("selectionTooBigPlural") + "'.replace('{limit}', limit); }");
    getSettings().setFormatLoadMore("function() { return '" + getEscapedJsString("loadMore") + "';}");
    getSettings().setFormatSearching("function() { return '" + getEscapedJsString("searching") + "';}");
}