You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tom Götz <to...@decoded.de> on 2015/06/23 14:12:35 UTC

Bootstrap Typeahead example?

Hi,

I’m currently trying to implement a Typeahead component using the wicket-bootstrap project (v 0.10.1, Wicket version 7.0.0-M5).
Is there some example how the template mechanism can be used (de.agilecoders.wicket.extensions.markup.html.bootstrap.form.typeaheadV10.DataSet#Templates)? I found one Typeahead example in the wicket-bootstrap-samples project, but no templates are used there. I’m looking for a way to e.g. add icons to each individual suggestion …

Any hint or small code sample available?

Cheers,
   -Tom




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Bootstrap Typeahead example?

Posted by Martin Grigorov <mg...@apache.org>.
Hi Tom,

According to https://twitter.github.io/typeahead.js/examples/ you should
generate JS like:

$('#custom-templates .typeahead').typeahead(null, {
  name: 'best-pictures',
  display: 'value',
  source: bestPictures,
  templates: {
    empty: [
   ...

So you need a Typeahead component, with typeaheadV10.TypeaheadConfig
that has first Dataset as null, and a second with the templates.

Looking at the JS snippet I think the Templates type should be
AbstractConfig, but it Json.RawValue :-/ You can workaround this by
using new Json.RawValue("empty: 'your template for empty here'").

You may want to subscribe to
https://groups.google.com/forum/#!forum/wicket-bootstrap. Maybe the
contributor of this component is subscribed there and would have
responded earlier with a better response than me.


Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Jun 23, 2015 at 3:12 PM, Tom Götz <to...@decoded.de> wrote:

> Hi,
>
> I’m currently trying to implement a Typeahead component using the
> wicket-bootstrap project (v 0.10.1, Wicket version 7.0.0-M5).
> Is there some example how the template mechanism can be used
> (de.agilecoders.wicket.extensions.markup.html.bootstrap.form.typeaheadV10.DataSet#Templates)?
> I found one Typeahead example in the wicket-bootstrap-samples project, but
> no templates are used there. I’m looking for a way to e.g. add icons to
> each individual suggestion …
>
> Any hint or small code sample available?
>
> Cheers,
>    -Tom
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>