Package org.wicketstuff.select2.json

Examples of org.wicketstuff.select2.json.StringBuilderWriter


      value = getModelObject();
    }

    if (value != null) {

      JsonBuilder selection = new JsonBuilder();

      try {
        selection.object();
        getProvider().toJson(value, selection);
        selection.endObject();
      } catch (JSONException e) {
        throw new RuntimeException("Error converting model object to Json", e);
      }
      response.render(OnDomReadyHeaderItem.forScript(JQuery.execute("$('#%s').select2('data', %s);", getJquerySafeMarkupId(),
          selection.toJson())));
    }
  }
View Full Code Here


      choices = getModelObject();
    }

    if (choices != null && !choices.isEmpty()) {

      JsonBuilder selection = new JsonBuilder();

      try {
        selection.array();
        for (T choice : choices) {
          selection.object();
          getProvider().toJson(choice, selection);
          selection.endObject();
        }
        selection.endArray();
      } catch (JSONException e) {
        throw new RuntimeException("Error converting model object to Json", e);
      }

      response.render(OnDomReadyHeaderItem.forScript(JQuery.execute("$('#%s').select2('data', %s);", getJquerySafeMarkupId(),
          selection.toJson())));
    }
  }
View Full Code Here

TOP

Related Classes of org.wicketstuff.select2.json.StringBuilderWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.