|
35 | 35 | ></v-checkbox> |
36 | 36 | </span> |
37 | 37 | <span v-else v-html="col.title"></span> |
38 | | - <span @click.stop="sortControl(col.fields[0],col.orderBy)" |
| 38 | + <span @click.stop="sortControl(col.fields[0])" |
39 | 39 | class="v-table-sort-icon" v-if="enableSort(col.orderBy)"> |
40 | | - <i :class='["v-icon-up-dir",col.orderBy ==="asc" ? "checked":""]'></i> |
41 | | - <i :class='["v-icon-down-dir",col.orderBy ==="desc" ? "checked":""]'></i> |
| 40 | + <i :class='["v-icon-up-dir",getCurrentSort(col.field) ==="asc" ? "checked":""]'></i> |
| 41 | + <i :class='["v-icon-down-dir",getCurrentSort(col.field) ==="desc" ? "checked":""]'></i> |
42 | 42 | </span> |
43 | 43 | </span> |
44 | 44 | </div> |
|
68 | 68 | ></v-checkbox> |
69 | 69 | </span> |
70 | 70 | <span v-else v-html="col.title"></span> |
71 | | - <span @click.stop="sortControl(col.field,col.orderBy)" |
| 71 | + <span @click.stop="sortControl(col.field)" |
72 | 72 | class="v-table-sort-icon" v-if="enableSort(col.orderBy)"> |
73 | | - <i :class='["v-icon-up-dir",col.orderBy ==="asc" ? "checked":""]'></i> |
74 | | - <i :class='["v-icon-down-dir",col.orderBy ==="desc" ? "checked":""]'></i> |
| 73 | + <i :class='["v-icon-up-dir",getCurrentSort(col.field) ==="asc" ? "checked":""]'></i> |
| 74 | + <i :class='["v-icon-down-dir",getCurrentSort(col.field) ==="desc" ? "checked":""]'></i> |
75 | 75 | </span> |
76 | 76 | </span> |
77 | 77 | </div> |
|
188 | 188 | <span class="table-title"> |
189 | 189 | <span v-if="col.type === 'selection'"></span> |
190 | 190 | <span v-else v-html="col.title"></span> |
191 | | - <span @click.stop="sortControl(col.fields[0],col.orderBy)" |
| 191 | + <span @click.stop="sortControl(col.fields[0])" |
192 | 192 | class="v-table-sort-icon" v-if="enableSort(col.orderBy)"> |
193 | | - <i :class='["v-icon-up-dir",col.orderBy ==="asc" ? "checked":""]'></i> |
194 | | - <i :class='["v-icon-down-dir",col.orderBy ==="desc" ? "checked":""]'></i> |
| 193 | + <i :class='["v-icon-up-dir",getCurrentSort(col.field) ==="asc" ? "checked":""]'></i> |
| 194 | + <i :class='["v-icon-down-dir",getCurrentSort(col.field) ==="desc" ? "checked":""]'></i> |
195 | 195 | </span> |
196 | 196 | </span> |
197 | 197 | </div> |
|
221 | 221 | ></v-checkbox> |
222 | 222 | </span> |
223 | 223 | <span v-else v-html="col.title"></span> |
224 | | - <span @click.stop="sortControl(col.field,col.orderBy)" |
| 224 | + <span @click.stop="sortControl(col.field)" |
225 | 225 | class="v-table-sort-icon" |
226 | 226 | v-if="enableSort(col.orderBy)"> |
227 | | - <i :class='["v-icon-up-dir",col.orderBy ==="asc" ? "checked":""]'></i> |
228 | | - <i :class='["v-icon-down-dir",col.orderBy ==="desc" ? "checked":""]'></i> |
| 227 | + <i :class='["v-icon-up-dir",getCurrentSort(col.field) ==="asc" ? "checked":""]'></i> |
| 228 | + <i :class='["v-icon-down-dir",getCurrentSort(col.field) ==="desc" ? "checked":""]'></i> |
229 | 229 | </span> |
230 | 230 | </span> |
231 | 231 | </div> |
|
597 | 597 | return result; |
598 | 598 | }, |
599 | 599 |
|
600 | | - // 将复杂表头配置数据简单化 |
601 | | - titleRowsToSortInfo(){ |
602 | | - var result = [], self = this; |
603 | | -
|
604 | | - if (self.internalTitleRows.length > 0) { |
605 | | - self.internalTitleRows.filter(function (row) { |
606 | | - row.filter(function (column, index) { |
607 | | - if (typeof column.orderBy === 'string' && column.fields.length === 1) { |
608 | | - column.field = column.fields[0]; |
609 | | - result.push(column); |
610 | | - } |
611 | | - }) |
612 | | - }) |
613 | | - } |
614 | | - return result; |
615 | | - }, |
616 | | -
|
617 | | -
|
618 | 600 | // 所有列的总宽度 |
619 | 601 | totalColumnsWidth(){ |
620 | 602 | return this.internalColumns.reduce(function (total, curr) { |
|
747 | 729 |
|
748 | 730 | this.initTableWidth(); |
749 | 731 |
|
| 732 | + this.setSortColumns(); |
| 733 | +
|
750 | 734 |
|
751 | 735 | var self = this, widthCountCheck = 0; |
752 | 736 |
|
|
840 | 824 | this.scrollControl(); |
841 | 825 | } |
842 | 826 |
|
843 | | - this.singelSortInit(); |
| 827 | + //this.singleSortInit(); |
844 | 828 |
|
845 | 829 | this.controlScrollBar(); |
846 | 830 | }, |
|
0 commit comments