Inline DT with TAB key

Inline DT with TAB key

x14841003x14841003 Posts: 33Questions: 9Answers: 0

Hello

I have an inline datatable editor issue with the TAB key. Here is my initial working code :

editor3 = new $.fn.dataTable.Editor( {
    table: '#T3',
    fields: [ {
            label: "a",
            name: "a"
        }, {
            label: "b",
            name: "b"
        }, {
            label: "c",
            name: "c"
        }

    ]
} );

$('#T3').on( 'click', 'tbody td:not(:first-child)', function (e) {
    editor3.inline( this, {
            onBlur: 'submit'
    } );
} );

$('#T3').DataTable( {
    dom: 'Bfrtip',
    stateSave: true,
    searching: false,
    bPaginate: false,
    bInfo: false,
    ordering: false,
    columns: [
        { data: "a" },
        { data: "b" },
        { data: "c" }
    ],
    select: false,
    buttons: [
    ]
} );

This code works extremely nice. Based on this example ((https://editor.datatables.net/examples/inline-editing/tabControl.html) I wanted to put the TAB key in place, and then replaced the latest fragment by this one :

$('#T3').DataTable( {
    dom: 'Bfrtip',
    stateSave: true,
    searching: false,
    bPaginate: false,
    bInfo: false,
    ordering: false,
    columns: [
        { data: "a" },
        { data: "b" },
        { data: "c" }
    ],
    keys: {
        columns: ':not(:first-child)',
        keys: [ 9 ],
        editor: editor,
        editOnFocus: true
    },
    select: {
        style:    'os',
        selector: 'td:first-child'
    },
    buttons: [
    ]
} );

But the result is that the datatable does not allow inline editing anymore and as soon as i click on one cell the default behaviour appears : show X entries, column ordering is allowed, previous/next buttons appears... (which are set to false)

Do you have an idea where the problem is ? I have as well removed the 2nd fragment (with onblur) and copied the same 1st fragment as in the example but it does not work as well.

Thanks a lot, Bye
x1484

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586
    Answer ✓

    Hi @x14841003 ,

    If ordering and the DOM elements are returning it's suggesting the table is being reinitialised - those elements can't be disabled once initialised. Are you seeing console errors? If you could link to the page we can take a look,

    Cheers,

    Colin

  • x14841003x14841003 Posts: 33Questions: 9Answers: 0

    Hi Colin

    Sorry, my bad. The problem was

    editor: editor,

    which should be replaced by

    editor: editor3,

    But you helped me with the error console which revealed the issue.

    Thanks so much ! Bye
    x1484

This discussion has been closed.