Author: pyaschenko
Date: 2010-12-10 05:45:10 -0500 (Fri, 10 Dec 2010)
New Revision: 20493
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
Log:
http://jira.jboss.com/jira/browse/RF-9835
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-12-10
10:38:18 UTC (rev 20492)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-12-10
10:45:10 UTC (rev 20493)
@@ -45,8 +45,8 @@
import javax.servlet.jsp.jstl.sql.Result;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.component.AbstractAutocomplete;
import org.richfaces.component.AutocompleteLayout;
import org.richfaces.component.MetaComponentResolver;
@@ -208,9 +208,8 @@
ResponseWriter writer = facesContext.getResponseWriter();
writer.startElement(HtmlConstants.SCRIPT_ELEM, component);
writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript",
null);
- StringBuilder sb = new
StringBuilder("\njQuery(RichFaces.getDomElement('");
-
sb.append(component.getClientId(facesContext)).append("Items')).data({componentData:").append(ScriptUtils.toScript(fetchValues)).append("});\n");
- writer.write(sb.toString());
+ JSObject script = new JSObject("RichFaces.ui.Autocomplete.setData",
component.getClientId(facesContext)+"Items", fetchValues);
+ writer.writeText(script, null);
writer.endElement(HtmlConstants.SCRIPT_ELEM);
}
}
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-12-10
10:38:18 UTC (rev 20492)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-12-10
10:45:10 UTC (rev 20493)
@@ -465,4 +465,11 @@
}
};
})());
+
+ $.extend(rf.ui.Autocomplete, {
+ setData: function (id, data) {
+ $(rf.getDomElement(id)).data({componentData:data});
+ }
+ });
+
})(jQuery, RichFaces);
\ No newline at end of file