A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/selectize/selectize.js/issues/231 below:

Tagging and raw values · Issue #231 · selectize/selectize.js · GitHub

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!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4