Can you use colvis with datatable editor?

Can you use colvis with datatable editor?

the_macethe_mace Posts: 10Questions: 3Answers: 0

So in my case columns that are editable are selected like this:

    $('#test_data').on( 'click', 'tbody td:not(:first-child, ' +
        ':nth-child(1), ' +
        ':nth-child(2),' +
        ':nth-child(4),' +
        ':nth-child(14)' +
        ')', function (e) {
        editor.inline( table.cell( this ).index(), { onBlur: 'submit' });

When columns are hidden by colvis all the column numbers shift so whats clickable for editing changes. Right now colvis breaks the functionality so the editor only works correctly when all columns are shown.

Is there some way to make them both work better together?

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794
    Answer ✓

    Try adding a classname, using columns.className to the columns you want to inline edit. Change the selector by removing the :not() and just use the classname.

    Kevin

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    There is an example of what Kevin suggested available here.

    Allan

  • the_macethe_mace Posts: 10Questions: 3Answers: 0

    Thanks folks, I knew I was missing something obvious here. Appreciate the quick and thorough help!

Sign In or Register to comment.