Home > database >  Prevent click:row event on text selection on row
Prevent click:row event on text selection on row

Time:09-21

When text is selected in a v-data-table row, the click:row event is fired. Is there any way to prevent this?

Replicate sandbox

https://codesandbox.io/s/pedantic-nightingale-fbyk2

Instructions

  • Select any value in the table and watch the console

CodePudding user response:

A workaround would be to check if there was some selected text at the time you clicked. Your rowClick method would be:

    rowClick(item) {
      if (window.getSelection().toString()) {
        return;
      }
      console.log(item);
    }
  • Related