Revision d8133a85
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
templates/webpages/generic/autocomplete.html | ||
---|---|---|
16 | 16 |
action : action in the ajax script, defaults to 'ajax_autocomplete' |
17 | 17 |
selector : a jquery selector, specifying the input fields |
18 | 18 |
column : specifies the column that is represented by the bound field. typically description or name. |
19 |
params : additional params that should be included in the request, like customer/vendor information. expects a hash. |
|
19 | 20 |
|
20 | 21 |
TODO FIELDS: |
21 | 22 |
- addition fields like type, vc etc. |
22 | 23 |
- additional dependencies, see jquery.autocomplete documentation |
23 | 24 |
- hook function on select, again see jquery documentation |
25 |
- limit: maximum number of results shown. |
|
24 | 26 |
|
25 | 27 |
a simple SPEC would look like this: |
26 | 28 |
|
... | ... | |
43 | 45 |
[%- DEFAULT token.script = script %] |
44 | 46 |
[%- DEFAULT token.action = 'ajax_autocomplete' %] |
45 | 47 |
[%- DEFAULT token.INPUT_ENCODING = 'utf8' %] |
48 |
[%- FOREACH key = token.params.keys %] |
|
49 |
[%- token.additional_url = token.additional_url _ '&' _ key _ '=' _ token.params.$key %] |
|
50 |
[%- END %] |
|
46 | 51 |
[%- token.url = token.script |
47 | 52 |
_ '?action=' _ token.action |
48 | 53 |
_ '&INPUT_ENCODING=' _ token.INPUT_ENCODING %] |
49 | 54 |
[%- SET token.url = token.url _ '&column=' _ token.column IF token.column %] |
55 |
[%- SET token.url = token.url _ token.additional_url IF token.additional_url %] |
|
50 | 56 |
$(document).ready( $('[% token.selector %]').autocomplete('[% token.url %]')); |
51 | 57 |
[%- END %] |
52 | 58 |
</script> |
Auch abrufbar als: Unified diff
Autocomplete ergänzt um Support für weitere Parameter.