Search code examples
javascriptdatatablesyadcf

Multiple selection using text input - parameter don't work


In this example LIVE DEMO column 0 (called Some Data) have these parameters:

    {
        column_number: 0,
        filter_type: "multi_select",
        select_type: 'select2'
    },

With this parameter you can do multiple selection using text input:

multiple

I try implement select_type: 'select2' parameter but it doesn't work for my table.

I look jquery.dataTables.yadcf.js, I find multi_select_custom_func but this is not correct parameter to solve problem.
This is my table: MY TABLE

This is my rilevant javascript code:

    var oTable;
$(document).ready(function () {

'use strict';


    oTable = $('#example').dataTable({
        "bJQueryUI": true,
        "bStateSave": true
    }).yadcf([{

        column_number: 0,
        filter_type: "multi_select",
        select_type: 'multi_select_custom_func'
    }, {
        column_number: 4,
        filter_type: "range_number_slider",
        filter_container_id: "external_filter_container"
    }, {
        column_number: 3,
        text_data_delimiter: /(\s-\s)|,/,
        filter_type: "auto_complete"
    }, {
        column_number: 1,

        filter_type: "multi_select"
    }, {
        column_number: 2,
        text_data_delimiter: /(\s-\s)|,/,
        filter_type: "auto_complete"
    }, {
        column_number: 5,
        column_data_type: "html",
        html_data_type: "text",
        filter_default_label: "Select tag",
        filter_type: "auto_complete"


    }]);

Solution

  • You using wrong values for the wrong attributes,

    Take a look at the docs select_type - Possible values: chosen / select2 , continues reading and notice that the multi_select_custom_func can be set for the filter_type only.

    Anyway the problem in your case is that you haven't included the select2 js/css and you haven't set the select_type: 'select2'

    Here's an updated/fixed jsfiddle