Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Tagging and raw values #231

Closed
Closed

Description

@warnero

So, I've been playing around with this for a normal select scenario. We need to do a tagging implementation with typeahead so I turned back to this since it was so easy to use the first time around. Unfortunately I've run into some issues.

Here's my current selectize (which will grab a set of json array with value: 'my value', etc.

   $that.selectize({
        delimiter: ',',
        persist: true,
        preload: false,
        valueField: 'value',
        labelField:'value',
        create: function(input) {
                return {
                        value: input,
                        text: input
                }
        },
        options:[],
        load: function(query,callback) {
            //if (!query.length) return callback();
            $.ajax({
                url: '/' + id + '/tags',
                type: 'GET',
                error: function() {
                    callback();
                },
                success: function(res) {
                    callback(res);
                }
            });
        }
    });

After figuring out that I had to send data back as a json object so I could specify the label/value field names it worked great. But when I display something that already has data in it I can't for the life of me figure out what to put in the value="" for:

I've tried json data, the original comma-delimited items, all to no avail. So, is there a way to tell selectize to NOT use a field name and just grab the string that's in the array? Would save me a lot of headache. Read through the docs and poked at the JS directly but couldn't find anything that says this.

Thank you!

Activity

  1. sclausen commented on Jan 15, 2015

    @sclausen

    +1

  2. brianreavis commented on Jan 30, 2015

    @brianreavis
    Member

    See the 0.12.0 release for this. Selectize now recognizes the dataAttr attribute (data-data by default) for populating the initial values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions