Skip to content

Commit

Permalink
feat(table): Add row-dblclicked event (#780)
Browse files Browse the repository at this point in the history
* [table] Add row-dbl-clicked event

* [table] Add row-dblclicked event meta.json
  • Loading branch information
tmorehouse committed Aug 9, 2017
1 parent 763a35a commit 1aaf915
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/components/table/meta.json
Expand Up @@ -16,6 +16,20 @@
}
]
},
{
"event": "row-dblclicked",
"description": "Emitted when a row is double clicked.",
"args": [
{
"arg": "item",
"description": "Item data of the row being double clicked."
},
{
"arg": "index",
"description": "Index of the row being double clicked."
}
]
},
{
"event": "row-hovered",
"description": "Emitted when a row is hovered.",
Expand Down
10 changes: 10 additions & 0 deletions lib/components/table.vue
Expand Up @@ -50,6 +50,7 @@
:key="index"
:class="rowClass(item)"
@click="rowClicked($event,item,index)"
@dblclick="rowDblClicked($event,item,index)"
@hover="rowHovered($event,item,index)"
>
<template v-for="(field,key) in fields">
Expand Down Expand Up @@ -466,6 +467,15 @@
}
this.$emit('row-clicked', item, index);
},
rowDblClicked(e, item, index) {
if (this.busy) {
// If table is busy (via provider) then don't propagate
e.preventDefault();
e.stopPropagation();
return;
}
this.$emit('row-dblclicked', item, index);
},
rowHovered(e, item, index) {
if (this.busy) {
// If table is busy (via provider) then don't propagate
Expand Down

0 comments on commit 1aaf915

Please sign in to comment.