Skip to content
This repository was archived by the owner on Apr 1, 2022. It is now read-only.

Commit 3b30934

Browse files
author
Ken Berkeley
committed
[fix] selection display issue in complex mode
1 parent dfeb57e commit 3b30934

File tree

13 files changed

+35
-18
lines changed

13 files changed

+35
-18
lines changed

dist/min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/en/details/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ src/
1010
│   ├─ ColumnGroup.vue
1111
│   └─ index.vue
1212
├─ MainTable
13-
│   ├─ _SCROLLBAR_WIDTH.js
14-
│   ├─ _syncScroll.js
1513
│   ├─ HeadSort.vue
1614
│   ├─ index.vue
1715
│   ├─ MultiSelect.vue
16+
│   ├─ SCROLLBAR_WIDTH.js
17+
│   ├─ shouldRenderSelection.mixin.js
18+
│   ├─ syncScroll.js
1819
│   ├─ TableBody.vue
1920
│   ├─ TableFooter.vue
2021
│   ├─ TableFrame.vue

doc/zh-cn/details/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ src/
1010
│   ├─ ColumnGroup.vue
1111
│   └─ index.vue
1212
├─ MainTable
13-
│   ├─ _SCROLLBAR_WIDTH.js
14-
│   ├─ _syncScroll.js
1513
│   ├─ HeadSort.vue
1614
│   ├─ index.vue
1715
│   ├─ MultiSelect.vue
16+
│   ├─ SCROLLBAR_WIDTH.js
17+
│   ├─ shouldRenderSelection.mixin.js
18+
│   ├─ syncScroll.js
1819
│   ├─ TableBody.vue
1920
│   ├─ TableFooter.vue
2021
│   ├─ TableFrame.vue

examples/src/Fixed/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div style="margin: 0 auto; width: 720px">
2+
<div style="margin: 0 auto; width: 800px">
33
<code>query: {{ query }}</code>
44
<datatable v-bind="$data" />
55
</div>

src/MainTable/MultiSelect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<input type="checkbox" v-model="status" @change="toggle" name="MultiSelect">
2+
<input type="checkbox" v-model="status" @change="toggle" style="margin: 0" name="MultiSelect">
33
</template>
44
<script>
55
import replaceWith from 'replace-with'

src/MainTable/TableBody.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<template v-if="data.length">
44
<template v-for="item in data">
55
<tr>
6-
<td v-if="selection" width="30px">
6+
<td v-if="shouldRenderSelection">
77
<multi-select :selection="selection" :row="item" />
88
</td>
99
<td v-for="col in columns" :class="col.tdClass" :style="col.tdStyle">
@@ -47,10 +47,11 @@
4747
<script>
4848
import MultiSelect from './MultiSelect.vue'
4949
import props from '../props.mixin'
50+
import shouldRenderSelection from './shouldRenderSelection.mixin'
5051
5152
export default {
52-
mixins: [props],
5353
components: { MultiSelect },
54+
mixins: [props, shouldRenderSelection],
5455
computed: {
5556
colLen () {
5657
return this.columns.length + !!this.selection

src/MainTable/TableFooter.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<tfoot>
33
<tr class="-summary-row">
4-
<td v-if="selection" width="30px"></td>
4+
<td v-if="shouldRenderSelection"></td>
55
<template v-for="(col, idx) in columns">
66
<!-- display the available fields only -->
77
<td v-if="summary[col.field]" :class="col.tdClass" :style="col.tdStyle">
@@ -25,9 +25,10 @@
2525
</template>
2626
<script>
2727
import props from '../props.mixin'
28+
import shouldRenderSelection from './shouldRenderSelection.mixin'
2829
2930
export default {
30-
mixins: [props]
31+
mixins: [props, shouldRenderSelection]
3132
}
3233
</script>
3334
<style>

src/MainTable/TableFrame.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<template>
22
<table class="table table-striped table-hover" style="margin-bottom: 0" :class="tblClass" :style="tblStyle">
33
<colgroup>
4+
<col v-if="shouldRenderSelection" style="width: 30px"></col>
45
<col v-for="col in columns" :class="col.colClass" :style="col.colStyle"></col>
56
</colgroup>
67
<slot />
78
</table>
89
</template>
910
<script>
1011
import props from '../props.mixin'
12+
import shouldRenderSelection from './shouldRenderSelection.mixin'
1113
1214
export default {
13-
mixins: [props]
15+
mixins: [props, shouldRenderSelection]
1416
}
1517
</script>

src/MainTable/TableHeader.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<thead>
33
<transition-group name="fade" tag="tr">
4-
<th v-if="selection" width="30px" key="--th-multi">
4+
<th v-if="shouldRenderSelection" key="--th-multi">
55
<multi-select :selection="selection" :rows="data" />
66
</th>
77
<th v-for="(col, idx) in columns"
@@ -30,9 +30,10 @@
3030
import HeadSort from './HeadSort.vue'
3131
import MultiSelect from './MultiSelect.vue'
3232
import props from '../props.mixin'
33+
import shouldRenderSelection from './shouldRenderSelection.mixin'
3334
3435
export default {
3536
components: { HeadSort, MultiSelect },
36-
mixins: [props]
37+
mixins: [props, shouldRenderSelection]
3738
}
3839
</script>

0 commit comments

Comments
 (0)