Examples of JqueryLookupField


Examples of javango.contrib.jquery.fields.JqueryLookupField

  public String getScript(BoundField field) {
    try {
      if (!field.getField().isEditable()) return "";
 
      if (field.getField() instanceof JqueryLookupField) {
        JqueryLookupField lookupField = (JqueryLookupField) field.getField();

        // TODO Need to get the form's id property for the format
        // maybe from the Field's attr map
        String fieldId = String.format("id_%s", field.getHtmlName());
       
        Map<String, String> urlParameters = new HashMap<String, String>();
        urlParameters.put("model", lookupField.getModel().getCanonicalName());
        urlParameters.put("display", lookupField.getDisplay());
        urlParameters.put("search", lookupField.getSearch());
        urlParameters.put("results", lookupField.getResults());
        urlParameters.put("field", fieldId);
        if (lookupField.getOrderBy() != null) urlParameters.put("order_by", lookupField.getOrderBy());
 
        return String.format(
            "$('#%1$s').javangoLookupWidget('%2$s', '%3$s');",
            fieldId,                  // 1 TODO not correct, should use ID
            URLEncoder.encode(encrypt(urlParameters), "UTF-8"),    // 2
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.