fmoo / react-typeahead

Pure react-based typeahead and typeahead-tokenizer
ISC License
677 stars 232 forks source link

Render tokenizer with several values #177

Closed juanda99 closed 8 years ago

juanda99 commented 8 years ago

Just starting using this component. Trying to implement it as a editor with adazzle/react-data-grid.

I have a table where I want to render several items on a field. I started using this component, so I can create several items:

Item 1 created
Item 1 created
Autocomplete

But how can I render those elements (item 1 and item2) when reading from an ajax call for example? Should I do it by hand? Creating the dom elements? Is there something implemented?

juanda99 commented 8 years ago

I just looked better through the docs, property defaultSelected was what I needed.

 var valores = ['prueba1', 'prueba2', 'prueba3']
    return (
      <Tokenizer defaultValue={valor} defaultSelected={valores}

        options={
          ['foobar', 'spameggs', 'hameggs',
          'spamfoo', 'spam', 'prueba1', 'prueba2', 'prueba3', 'prueba4', 'prueba5']} />