Table Column add indexMethod
This commit is contained in:
parent
fc3e16cf01
commit
d9d1dbbd5a
2 changed files with 11 additions and 10 deletions
|
@ -1,20 +1,21 @@
|
|||
<template>
|
||||
<div>
|
||||
<Table border ref="selection" :columns="columns4" :data="data1"></Table>
|
||||
<br><br>
|
||||
<Button @click="handleSelectAll(true)">Set all selected</Button>
|
||||
<Button @click="handleSelectAll(false)">Cancel all selected</Button>
|
||||
<Table highlight-row ref="currentRowTable" :columns="columns3" :data="data1"></Table>
|
||||
<Button @click="handleClearCurrentRow">Clear</Button>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
columns4: [
|
||||
columns3: [
|
||||
{
|
||||
type: 'selection',
|
||||
type: 'index',
|
||||
width: 60,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
indexMethod (row) {
|
||||
return row._index;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Name',
|
||||
|
@ -58,8 +59,8 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
handleSelectAll (status) {
|
||||
this.$refs.selection.selectAll(status);
|
||||
handleClearCurrentRow () {
|
||||
this.$refs.currentRowTable.clearCurrentRow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div :class="classes" ref="cell">
|
||||
<template v-if="renderType === 'index'"><span>{{naturalIndex + 1}}</span></template>
|
||||
<template v-if="renderType === 'index'"><span>{{ column.indexMethod ? column.indexMethod(row) : (naturalIndex + 1) }}</span></template>
|
||||
<template v-if="renderType === 'selection'">
|
||||
<Checkbox :value="checked" @click.native.stop="handleClick" @on-change="toggleSelect" :disabled="disabled"></Checkbox>
|
||||
</template>
|
||||
|
|
Loading…
Add table
Reference in a new issue