Repository: tapestry-5 Updated Branches: refs/heads/master 7a2f98c8e -> 3b8fe942b
TAP5-2292 : Autocomplete Mixin shows only 5 suggestions Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/b35cd7e3 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/b35cd7e3 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/b35cd7e3 Branch: refs/heads/master Commit: b35cd7e3e5e0939e841189efe5c40d64f4d6186e Parents: d9a795f Author: Thiago H. de Paula Figueiredo <thiag...@apache.org> Authored: Mon Jun 30 19:03:21 2014 -0300 Committer: Thiago H. de Paula Figueiredo <thiag...@apache.org> Committed: Mon Jun 30 19:03:21 2014 -0300 ---------------------------------------------------------------------- .../META-INF/modules/t5/core/autocomplete.coffee | 1 + .../org/apache/tapestry5/corelib/mixins/Autocomplete.java | 8 +++++++- tapestry-core/src/test/app1/AutocompleteDemo.tml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b35cd7e3/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee index 7dbb2da..1a33e94 100644 --- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee +++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee @@ -23,6 +23,7 @@ define ["./dom", "./ajax", "jquery", "./utils", "./typeahead"], $field.typeahead minLength: spec.minChars + limit: spec.limit remote: url: spec.url replace: (uri, query) -> extendURL uri, "t:input": query http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b35cd7e3/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java index 7fce141..074ce88 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java @@ -91,6 +91,12 @@ public class Autocomplete private String tokens; /** + * Maximum number of suggestions shown in the UI. It maps to Typeahead's "limit" option. Default value: 5. + */ + @Parameter("5") + private int maxSuggestions; + + /** * The context for the "providecompletions" event. * This list of values will be converted into strings and included in * the URI. The strings will be coerced back to whatever their values are and made available to event handler @@ -122,7 +128,7 @@ public class Autocomplete Link link = resources.createEventLink(EVENT_NAME, context); JSONObject spec = new JSONObject("id", field.getClientId(), - "url", link.toString()).put("minChars", minChars); + "url", link.toString()).put("minChars", minChars).put("limit", maxSuggestions); jsSupport.require("t5/core/autocomplete").with(spec); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b35cd7e3/tapestry-core/src/test/app1/AutocompleteDemo.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/app1/AutocompleteDemo.tml b/tapestry-core/src/test/app1/AutocompleteDemo.tml index 918ed85..b74074f 100644 --- a/tapestry-core/src/test/app1/AutocompleteDemo.tml +++ b/tapestry-core/src/test/app1/AutocompleteDemo.tml @@ -5,7 +5,7 @@ <t:errors/> - <t:textfield t:id="title" t:mixins="autocomplete,formgroup" tokens=",;" size="60"/> + <t:textfield t:id="title" t:mixins="autocomplete,formgroup" tokens=",;" maxSuggestions="10" size="60"/> <t:textfield t:id="withContext" t:mixins="autocomplete,formgroup" context="context"/> <div class="form-actions">