Skip to content

Commit

Permalink
Fixed #82 - Add row-click event to Table
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Nov 20, 2019
1 parent 0803bac commit b271690
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/components/datatable/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -616,19 +616,21 @@ export default {
},
onRowClick(e) {
const event = e.originalEvent;
const rowData = e.data;
const rowIndex = e.index;
const target = event.target;
const targetNode = target.nodeName;
const parentNode = target.parentElement && target.parentElement.nodeName;
if (targetNode == 'INPUT' || targetNode == 'BUTTON' || targetNode == 'A' ||
parentNode == 'INPUT' || parentNode == 'BUTTON' || parentNode == 'A' ||
(DomHandler.hasClass(target, 'p-clickable'))) {
return;
}
this.$emit('row-click', event);
if (this.selectionMode) {
let target = event.target;
let targetNode = target.nodeName;
let parentNode = target.parentElement && target.parentElement.nodeName;
if (targetNode == 'INPUT' || targetNode == 'BUTTON' || targetNode == 'A' ||
parentNode == 'INPUT' || parentNode == 'BUTTON' || parentNode == 'A' ||
(DomHandler.hasClass(target, 'p-clickable'))) {
return;
}
const rowData = e.data;
const rowIndex = e.index;
if (this.isMultipleSelectionMode() && event.shiftKey && this.anchorRowIndex != null) {
DomHandler.clearSelection();
Expand Down

0 comments on commit b271690

Please sign in to comment.