22 <div >
33 <div v-if =" $slots.default || HeaderSettings" class =" m-b-10 clearfix" >
44 <header-settings v-if =" HeaderSettings" class =" pull-right"
5- :col-groups =" columns" :support-backup =" supportBackup" />
5+ :col-groups =" columns" :support-backup =" supportBackup" >
6+ </header-settings >
67 <slot ></slot >
78 </div >
8- <!-- `.panel.panel-default` is for Rounded table, see http://stackoverflow.com/a/20903465/5172890 -->
9+ <!-- `.panel.panel-default` is for rounded table, see http://stackoverflow.com/a/20903465/5172890 -->
910 <div class =" table-responsive panel panel-default" >
1011 <table class =" table table-striped table-hover" :class =" { 'table-bordered': tableBordered }" >
1112 <thead >
1213 <transition-group name =" fade" tag =" tr" >
1314 <th v-if =" selection && data.length" width =" 1em" key =" th-multi" >
1415 <multi-select :selection =" selection" :rows =" data" />
1516 </th >
16- <th v-for =" (column, idx) in columns$"
17- :key =" column.title || column.field || idx"
17+ <th v-for =" (column, idx) in columns$" :key =" column.title || column.field || idx"
1818 :class =" column.thClass" :style =" column.thStyle" >
19- <!-- table head component (thComp) -->
20- <component v-if =" column.thComp" :is =" comp[column.thComp]"
21- :column =" column" :field =" column.field" :title =" column.title"
22- v-bind =" $props" ><!-- `v-bind` here is just like spread operator in JSX -->
19+ <!-- table head component (thComp). `v-bind` here is just like spread operator in JSX -->
20+ <component v-if =" column.thComp" :is =" comp[column.thComp]" v-bind =" $props"
21+ :column =" column" :field =" column.field" :title =" column.title" >
2322 </component >
24- <template v-else >{{ column.title }}</template >
23+ <template v-else >
24+ {{ column.title }}
25+ </template >
2526
2627 <i v-if =" column.explain" class =" fa fa-info-circle cursor-help" :title =" column.explain" ></i >
27- <head-sort v-if =" column.sort" :field =" column.field" v-bind = " $props " class =" pull-right" />
28+ <head-sort v-if =" column.sort" :field =" column.field" :query = " query " class =" pull-right" />
2829 </th >
2930 </transition-group >
3031 </thead >
3940 <component v-if =" column.tdComp" :is =" comp[column.tdComp]" v-bind =" $props"
4041 :row =" item" :field =" column.field" :value =" item[column.field]" :nested =" item.__nested__" >
4142 </component >
42- <template v-else >{{ item[column.field] }}</template >
43+ <template v-else >
44+ {{ item[column.field] }}
45+ </template >
4346 </td >
4447 </tr >
4548 <transition name =" fade" >
4649 <tr v-if =" item.__nested__ && item.__nested__.visible" >
47- <td :colspan =" columns$.length + (+!!selection) " >
50+ <td :colspan =" colspan " >
4851 <!-- nested component -->
4952 <component :is =" comp[item.__nested__.comp]"
5053 :row =" item" :nested =" item.__nested__" v-bind =" $props" >
5457 </transition >
5558 </template >
5659 <tr v-if =" !data.length" >
57- <td :colspan =" columns$.length + (+!!selection)" class =" text-center text-muted" >( No Data )</td >
60+ <td :colspan =" colspan" class =" text-center text-muted" >
61+ ( No Data )
62+ </td >
5863 </tr >
5964 <tr v-if =" summary && data.length" class =" -summary-row" >
6065 <td v-if =" selection" width =" 1em" ></td >
6570 <component v-if =" column.tdComp" :is =" comp[column.tdComp]" v-bind =" $props"
6671 :row =" summary" :field =" column.field" :value =" summary[column.field]" >
6772 </component >
68- <template v-else >{{ summary[column.field] }}</template >
73+ <template v-else >
74+ {{ summary[column.field] }}
75+ </template >
6976 </td >
7077 <td v-else >
7178 <!-- show summary label if the first column field has no data -->
7986 <div v-if =" Pagination" class =" row" >
8087 <div class =" col-sm-6 nowrap" >
8188 <strong >Total {{ total }} ,</strong >
82- <limit-select v-bind = " $props " />
89+ <limit-select :query = " query " />
8390 </div >
8491 <div class =" col-sm-6" >
85- <pagination class =" pull-right" v-bind = " $props " />
92+ <pagination class =" pull-right" :total = " total " :query = " query " />
8693 </div >
8794 </div >
8895 </div >
@@ -111,7 +118,7 @@ export default {
111118 xprops: Object , // extra custom props passing to dynamic components
112119 supportBackup: Boolean , // support header settings backup
113120 supportNested: Boolean , // support nested components
114- tableBordered: Boolean // add .table-bordered to <table>
121+ tableBordered: Boolean // add ` .table-bordered` to <table>
115122 },
116123 created () { // init query
117124 const { query } = this
@@ -138,6 +145,9 @@ export default {
138145 // the sort shown below is not stable
139146 // return columns$.map(col => ((col.weight = col.weight || 0), col)).sort((a, b) => b.weight - a.weight)
140147 },
148+ colspan () {
149+ return this .columns$ .length + (+ !! this .selection )
150+ },
141151 data$ () {
142152 const { data } = this
143153 if (this .supportNested ) {
0 commit comments