Skip to content

Tagging and raw values #231

Closed
Closed
@warnero

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!

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