Commit 9fa5771d authored by Arnaud Fontaine's avatar Arnaud Fontaine

RelationField: Support older version of jQuery UI (<= 1.9) for autocompletion.

parent 35ed3fa9
...@@ -381,9 +381,16 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, ...@@ -381,9 +381,16 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
return """ return """
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("input[name='%s']").ERP5Autocomplete({search_portal_type: %s, var autocomplete = $("input[name='%s']").ERP5Autocomplete({search_portal_type: %s,
search_catalog_key: "%s"}) search_catalog_key: "%s"});
.data("ui-autocomplete")._renderItem = function(ul, item) {
autocomplete = autocomplete.data("autocomplete") ?
// jQuery UI <= 1.8
autocomplete.data("autocomplete") :
// jQuery UI > 1.8
autocomplete.data("ui-autocomplete");
autocomplete._renderItem = function(ul, item) {
return $("<li></li>").data("item.autocomplete", item) return $("<li></li>").data("item.autocomplete", item)
.append("<a><b>" + .append("<a><b>" +
item.label + item.label +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment