Commit f054d426 authored by Arnaud Fontaine's avatar Arnaud Fontaine

erp5_autocompletion_ui: Support properly Input Method Editor for autocompletion.

parent 9fa5771d
...@@ -59,6 +59,13 @@ $(function() {\n ...@@ -59,6 +59,13 @@ $(function() {\n
});\n });\n
};\n };\n
}\n }\n
\n
function search(event, ui) {\n
// Ignore key input if processing with Input Method Editor\n
if(event.keyCode == 229)\n
return false;\n
return true;\n
} \n
\n \n
/*\n /*\n
* Wrapper around jQuery.ui.autocomplete that queries catalog\n * Wrapper around jQuery.ui.autocomplete that queries catalog\n
...@@ -78,7 +85,8 @@ $(function() {\n ...@@ -78,7 +85,8 @@ $(function() {\n
*/\n */\n
$.fn.ERP5Autocomplete = function(kw) {\n $.fn.ERP5Autocomplete = function(kw) {\n
return this.autocomplete({source: generateSource(kw),\n return this.autocomplete({source: generateSource(kw),\n
delay: 600});\n delay: 600,\n
search: search});\n
};\n };\n
});\n });\n
</tal:block> </tal:block>
......
2014-02-06 arnaud.fontaine
* Support properly Input Method Editor for autocompletion.
2014-01-27 arnaud.fontaine 2014-01-27 arnaud.fontaine
* RelationField: Implement autocompletion and use it by default once erp5_autocompletion_ui is installed. * RelationField: Implement autocompletion and use it by default once erp5_autocompletion_ui is installed.
......
10 11
\ No newline at end of file \ No newline at end of file
...@@ -382,7 +382,13 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, ...@@ -382,7 +382,13 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
var autocomplete = $("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"})
.keyup(function(event) {
// With Input Method Editor, Enter allows to select between choices
if(event.keyCode == 13) {
$(this).autocomplete("search");
}
});
autocomplete = autocomplete.data("autocomplete") ? autocomplete = autocomplete.data("autocomplete") ?
// jQuery UI <= 1.8 // jQuery UI <= 1.8
......
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