Can I change multi-select separator?


#1

I’d like to replace the separator with a semicolon instead of a comma.
a, b, c => a; b; c

Is there any way?


#2

Hi Junyoung,

This is currently not configurable. Could be done with a bit of a custom logic.

Example:

<input id="test" />
    var selectData = [
        { value: 1, text: 'Option 1' },
        { value: 2, text: 'Option 2' },
        { value: 3, text: 'Option 3' },
        { value: 4, text: 'Option 4' },
        { value: 5, text: 'Option 5' }
    ];

    var dataMap = {};

    selectData.forEach(function (v) {
        dataMap[v.value] = v;
    });

    $('#test').mobiscroll().select({
        data: selectData,
        select: 'multiple',
        onSet: function (ev, inst) {
            var values = inst.getVal(),
                texts = [];

            values.forEach(function (v) {
                texts.push(dataMap[v].text);
            });

            inst._$input.val(texts.join('; '));
        }
    });

#3

Thank you for reply.

But inst._$input is undefined.

What should I do?