About key to 'delete' row

About key to 'delete' row

Juninho De LucaJuninho De Luca Posts: 7Questions: 2Answers: 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: 63,676Questions: 1Answers: 10,497 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: 7Questions: 2Answers: 0

    Thank you, allan

This discussion has been closed.