About key to 'delete' row

About key to 'delete' row

Juninho De LucaJuninho De Luca Posts: 4Questions: 1Answers: 0

Heya,
I was wondering if its possible to bind the remove() button to key: 'delete', and could not find a answer.
https://datatables.net/forums/discussion/29044/support-for-keyboard-delete-key
It´s currently in use?

Thanks guys!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 48,908Questions: 1Answers: 7,133 Site admin
    Answer ✓
    $(document).on('keyup', function ( e ) {
      if ( e.keyCode === 46  && table.rows( { selected: true } ).any() ) { // 46 == delete key
        editor.remove( table.rows( { selected: true } ).indexes();
      }
    } );
    

    should do it.

    Allan

  • Juninho De LucaJuninho De Luca Posts: 4Questions: 1Answers: 0

    Thank you, allan

Sign In or Register to comment.