3

According to what I see in vue-good-table documentationn there's no right-click event exist, only click, dbl-click, mouseEnter..

I need to have a context-menu opened on right-click for each row. Do someone have any suggestions how to solve the problem?

Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164
TinkerBel
  • 115
  • 1
  • 10

1 Answers1

5

You could use Custom row template and add @contextmenu event as follows:

<vue-good-table :columns="columns" :rows="rows">
  <template slot="table-row" slot-scope="props">

      <div @contextmenu.prevent="openMenu($event,props.row)" >
           {{props.formattedRow[props.column.field]}}
       </div> 

  </template>
</vue-good-table>

for more clarification check this code

TinkerBel
  • 115
  • 1
  • 10
Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164
  • Thanks a lot!! This was exactly what I was looking for.. And great – TinkerBel Dec 31 '18 at 08:36
  • .. And great code example too ! **one more question** - in your example I saw that if you right-click very close to the border of the row you get the default right-click menu , how can i hide it ? – TinkerBel Dec 31 '18 at 08:42
  • that `div` element should have full width and height and no padding inside the `td` element – Boussadjra Brahim Dec 31 '18 at 11:30