Problem with selectize / with dependent
Problem with selectize / with dependent
Hi,
I have a question / problem with "selectize".
I setup a field the way it is explained here:
https://editor.datatables.net/plug-ins/field-type/editor.selectize
(but I use the current version 0.12.6: https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.js)
I also use:
<style> div.selectize-dropdown {  z-index: 2001; }</style>
If I use the normal "select" in my code the values are displayed - if I use selectize  they are not.
Here are the relevant parts of the code:
positionseditor = new $.fn.dataTable.Editor({
        ajax: {
            url: "stepposition_process",
            type: 'POST',
            data: function(d) {
                d.stepid = rowDataSTEP.tbladib_step.stepid;
                d.wsModuleid = rowDataSTEP.tbladib_step.wsModuleid;
            }
        },
        table: table,
        fields: [
            {
                label: "srcField:",
                name: "tbladib_step_position.srcField",                        
                type: "selectize",
//                options: [{"label":"ProductCode","value":"ProductCode"},{"label":"EndUseName","value":"EndUseName"},{"label":"Markets","value":"Markets"}],                
            opts: {
                    create: true,
                    maxItems: 3,
                    maxOptions: 15,
                    openOnFocus: true,
                    allowEmptyOption: false,
                    placeholder: "Please a field/name "
                    } 
            },
...
    positionseditor.dependent( 'tbladib_step_position.srcField', 'fieldlist', {  event: 'mousedown' });        
The structure of the response of the function "fieldlist" is as follows:
{"tbladib_step_position.srcField":{"options":[{"label":"ProductCode","value":"ProductCode"},{"label":"EndUseName","value":"EndUseName"},{"label":"Markets","value":"Markets"}]}}
<I tried to switch "tbladib_step_position.srcField" and "options" - but without effect.>
What do I wrong?
Thanks!!
Replies
Can you give me a link to your page please? If you inspect the DOM, is the Selectize dropdown there, but just doesn't have a high enough z-index?
Thanks,
Allan
Hi allan,
thanks for that hint - the elements are now show.
But - I do not yet see how I can save the selection (I need multi-select with
the possibility to add elements) into a simple text-field (with a defined seperator).
Example:
Ajax gives the field "ProductCode" and "Markets".
The user takes the field "Markets" and just adds a string "Area".
My intention is to save in this case the text : Markets;Area in the corresponding field in the table.
If the user later opens it - Markets and Area should appear as the two selected elements. (with the possibility to add or change fields).
Is this possible with selectize and editor?? <I would always use "simple text fields" to save the selection.>
Maybe this could be done in the javascript of your example:
Thank you so much!
Yes, that should be possible using the Selectize configuration (from their documentation):
If that isn't working for you can you give me a link to the page please.
Allan