11<template >
2- <tr @dblclick =" rowDblclickAction(props.item)" :class =" activityClass(props.item.meta.active)" >
2+ <tr @dblclick =" rowDblclickAction(props.item, props.index )" :class =" [ activityClass(props.item.meta.active), currentClass(props.item.meta.id)] " >
33 <td >
44 <v-checkbox
55 hide-details
1111 <td class =" cell-nowrap" >
1212 <!-- edit record -->
1313 <v-tooltip top v-if =" editButton" >
14- <v-btn fab small class =" xs white--text" color =" orange" @click =" edit(props.item.meta.id)" slot =" activator" >
14+ <v-btn fab small class =" xs white--text" color =" orange" @click =" edit(props.item.meta.id, props.index )" slot =" activator" >
1515 <v-icon >edit</v-icon >
1616 </v-btn >
1717 <span >{{ $t('global.datatable.buttons.edit') }}</span >
1818 </v-tooltip >
1919 <!-- custom buttons -->
2020 <v-tooltip top v-for =" (customButton) in customButtons" :key =" customButton.name" >
21- <v-btn fab :disabled =" !props.item.meta.buttons[customButton.name]" small class =" xs white--text" :color =" customButton.color" @click =" custom(customButton.name, props.item)" slot =" activator" >
21+ <v-btn fab :disabled =" !props.item.meta.buttons[customButton.name]" small class =" xs white--text" :color =" customButton.color" @click =" custom(customButton.name, props.item, props.index )" slot =" activator" >
2222 <v-icon >{{ customButton.icon }}</v-icon >
2323 </v-btn >
2424 <span >{{ customButton.text }}</span >
6767
6868<script >
6969import FileDetails from ' ./FileDetails.vue'
70+ import { mapState } from " vuex" ;
7071
7172export default {
7273 components: {
@@ -93,6 +94,9 @@ export default {
9394 return rField
9495 },
9596 },
97+ computed: {
98+ ... mapState (" crud" , [' currentItemId' ]),
99+ },
96100 methods: {
97101 fileFieldToJSON (field ) {
98102 return JSON .parse (field)
@@ -104,9 +108,13 @@ export default {
104108 }
105109 return className
106110 },
107- rowDblclickAction (item ) {
111+ currentClass (itemId ) {
112+ let currentId = this .currentItemId
113+ return itemId == currentId ? ' secondary' : ' '
114+ },
115+ rowDblclickAction (item , index ) {
108116 if (this .editButton ){
109- this .edit (item .meta .id )
117+ this .edit (item .meta .id , index )
110118 }
111119 else {
112120 let goToItemButton = false
@@ -117,12 +125,12 @@ export default {
117125 }
118126 }
119127 if (goToItemButton){
120- this .custom (' goToItem' , item)
128+ this .custom (' goToItem' , item, index )
121129 }
122130 }
123131 },
124- edit (id ) {this .$emit (' edit' , id)},
125- custom (name , item ) {this .$emit (' custom' , name, item)},
132+ edit (id , index ) {this .$emit (' edit' , id, index )},
133+ custom (name , item , index ) {this .$emit (' custom' , name, item, index )},
126134 suspend (id ) {this .$emit (' suspend' , id)},
127135 restore (id ) {this .$emit (' restore' , id)},
128136 destroy (id ) {this .$emit (' destroy' , id)},
0 commit comments