Skip to content
This repository was archived by the owner on Jun 10, 2021. It is now read-only.

Commit 332d86e

Browse files
committed
Added support to define conditions in actions with the current selected row
1 parent d4c712b commit 332d86e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/components/Datasource.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,16 @@ export default {
166166
},
167167
actionsObject () {
168168
return this.actions.map((action, index) => {
169-
return <button class={this.dynamicClass('btn', action.class)} type="button" on-click={ (e) => action.event(e, this.selected) }>
170-
<i class={ this.dynamicClass('pr1', action.icon) }></i>
171-
{ action.text }
172-
</button>
169+
try {
170+
if (action.show(this.selected)) {
171+
return <button class={this.dynamicClass('btn', action.class)} type="button" on-click={ (e) => action.event(e, this.selected) }>
172+
<i class={ this.dynamicClass('pr1', action.icon) }></i>
173+
{ action.text }
174+
</button>
175+
}
176+
} catch (ex) {
177+
console.warn(`[VueDatasource] The callback show is not defined in action ${action.text}.`)
178+
}
173179
})
174180
},
175181
tableInfo: DatasourceUtils.tableInfo

0 commit comments

Comments
 (0)