Search code examples
datatablesjquery-chosenyadcf

yadcf "select_type_options" not effective for Chosen


I am using yadcf to create a filter with "select_type":"chosen"in a separate large container. As the chosen-Dropdown was rendered too small, I added "select_type_options":"width:200px;" but that has not had any effect. Does that info need to be provided in a different format - or have I hit a bug?


Solution

  • Its not a bug, select_type_options property type is an object, so you should feed it an object value with key/value

    Fix your code from

    "select_type_options":"width:200px;"

    into

    select_type_options: { width: '200px;' }

    See from docs:

    * select_type_options
        Required:           false
        Type:               Object
        Default value:      {}
        Description:        This parameter will be passed "as is" to the Chosen/Select2 plugin constructor
    

    You can also find this in the showcase code snippet