Search code examples
javascriptvue.jsvuejs2vue-componentvue-good-table

Is there a right click event on vue-good-table rows to show a context menu?


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?


Solution

  • 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