Separator option for select error if cell is null

Separator option for select error if cell is null

epoch1epoch1 Posts: 17Questions: 8Answers: 1

Hi all,

I want to use the multiple and separator options for a select field type however the field may be empty in the datatable until it is edited. If the field initially has data everything works but when empty I get the following error: b is null - dataTables.editor.min.js:138:29, I guess becasue the field is null.

Can anyone help with this please?

I seem to be having a similar issue to the one discussed here:

https://datatables.net/forums/discussion/31581/using-the-separator-option-with-multiple

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    Hi,

    Completely agree - this is a bug in Editor. I've committed the fix and it will be in 1.6.2 (releases within the next two weeks is the plan). In the mean time, to hot fix, find:

            if ( conf.multiple && conf.separator && ! $.isArray( val ) ) {
                val = val.split( conf.separator );
            }
    

    and replace with:

            if ( conf.multiple && conf.separator && ! $.isArray( val ) ) {
                val = typeof val === 'string' ?
                    val.split( conf.separator ) :
                    [];
            }
    

    Regards,
    Allan

  • epoch1epoch1 Posts: 17Questions: 8Answers: 1

    That's brilliant Allan. Thanks.

This discussion has been closed.