Editor - "Tab" between columns using the enter key

Editor - "Tab" between columns using the enter key

UnicomUnicom Posts: 4Questions: 2Answers: 0
edited August 2019 in Free community support

I'm looking for a way to switch between columns in inline mode using the enter key instead of the tab key. Is there any way to override the default enter key action and set it up with keys.keys?

I have searched the forums high and low but could not find any up-to-date info remotely relating to this.

I cannot link to my page as it is restricted, but this is what I have so far:

editor = new $.fn.dataTable.Editor({
        table: '#irpdatalist',
        fields: [
            {name: "fileNo"},
            {name: "holderNo"},
            {name: "name"},
            {name: "fleetNo"},
            {name: "weightGroup"},
            {name: "activeDate"},
            {name: "inactiveDate"}
        ]
    });

    $('#irpdatalist').on( 'click', 'tbody td', function (e) {
        editor.inline( this, {
            onReturn: 'none'
        });
    } );
    
    var table = $('#irpdatalist').DataTable({
        dom: "Bfrtip",
        ajax: "searcheditor.json",
        order: [[2, 'asc']],
        columns: [
            {data: "fileNo"},
            {data: "holderNo"},
            {data: "name"},
            {data: "fleetNo"},
            {data: "weightGroup"},
            {data: "activeDate"},
            {data: "inactiveDate"}
        ],
        select: false,
        keys: {
            keys: [ 13 ],
            editor: editor,
            editOnFocus: true
        },
        "paging": false,
        "ordering": false,
        "info": false,
        "searching": false
    });

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,179Questions: 1Answers: 10,410 Site admin
    Answer ✓

    Hi,

    I'm afraid the reason you haven't found anything about this is that there isn't an option for it. The closest would be to listen for submitComplete and then use keys.move() to shift the KeyTable focus to the next cell. I'm slightly wary of that since submitComplete could be triggered by clicking out of the ell as well as pressing a return key. It might be possible to do some combination of events to handle that, but its not something I've looked into.

    Allan

  • UnicomUnicom Posts: 4Questions: 2Answers: 0

    I figured as much but thought i'd ask anyway. Thanks Allan.

This discussion has been closed.