From d8133a85574ba233d37685ebfb3f9f3c51e6edaa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 9 Dec 2009 12:45:37 +0100 Subject: [PATCH] =?utf8?q?Autocomplete=20erg=C3=A4nzt=20um=20Support=20f?= =?utf8?q?=C3=BCr=20weitere=20Parameter.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- templates/webpages/generic/autocomplete.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/webpages/generic/autocomplete.html b/templates/webpages/generic/autocomplete.html index 8ac18631b..5bd35c0b2 100644 --- a/templates/webpages/generic/autocomplete.html +++ b/templates/webpages/generic/autocomplete.html @@ -16,11 +16,13 @@ action : action in the ajax script, defaults to 'ajax_autocomplete' selector : a jquery selector, specifying the input fields column : specifies the column that is represented by the bound field. typically description or name. + params : additional params that should be included in the request, like customer/vendor information. expects a hash. TODO FIELDS: - addition fields like type, vc etc. - additional dependencies, see jquery.autocomplete documentation - hook function on select, again see jquery documentation + - limit: maximum number of results shown. a simple SPEC would look like this: @@ -43,10 +45,14 @@ [%- DEFAULT token.script = script %] [%- DEFAULT token.action = 'ajax_autocomplete' %] [%- DEFAULT token.INPUT_ENCODING = 'utf8' %] +[%- FOREACH key = token.params.keys %] +[%- token.additional_url = token.additional_url _ '&' _ key _ '=' _ token.params.$key %] +[%- END %] [%- token.url = token.script _ '?action=' _ token.action _ '&INPUT_ENCODING=' _ token.INPUT_ENCODING %] [%- SET token.url = token.url _ '&column=' _ token.column IF token.column %] +[%- SET token.url = token.url _ token.additional_url IF token.additional_url %] $(document).ready( $('[% token.selector %]').autocomplete('[% token.url %]')); [%- END %] -- 2.20.1