Search code examples
javascriptjqueryjquery-jtable

Jquery jTable - how to add multiselect dropdown?


i want to add multiselect functionality to a field. here is my current code for configuring jtable. how to implement multiselect functionality for a specified field

fields: {
        firstName: {
            title: 'name',
            width: '20%'
        },
        surname: {
            title: 'surname',
            width: '20%'
        },
        userName: {
            title: 'username',
            width: '20%',
            key: true,
            create: true
        },
        enabled: {
            title: 'status',
            type: 'radiobutton',
            options: [
                {Value: true, DisplayText: 'enabled'},
                {Value: false, DisplayText: 'disabled'}
            ],
            width: '20%'
        },
        roles: {
            /***********************************************
            // i wanna to enable multi-select for this field
            /***********************************************
            title: 'roles',
            options: [
                {Value: "ROLE_ADMIN", DisplayText: "admin"},
                {Value: "ROLE_USER", DisplayText: "user"}
            ]
        }
    }

Solution

  • Field Type should be multiselectddl

    Make sure you are using the jTable files available in this repository

    https://github.com/stanleyta/jtable/commit/6876303615a239dc409dee481a877a8f934f340d