|
125 | 125 | :style="Object.assign(cellStyle(record, item), renderColumnCellStyle(item, record))" |
126 | 126 | @mouseover="cellMouseOver" |
127 | 127 | @mousemove="cellMouseMove"> |
128 | | - <template v-if="item.format=='html'"><span v-html="item.toText(record[item.name])" /></template> |
129 | | - <template v-else>{{ item.toText(record[item.name]) }}</template> |
| 128 | + <template v-if="item.format=='html'"><span v-html="item.toText(record[item.name], record, item)" /></template> |
| 129 | + <template v-else>{{ item.toText(record[item.name], record, item) }}</template> |
130 | 130 | </td> |
131 | 131 | <td v-if="vScroller.buttonHeight < vScroller.height" class="last-col"></td> |
132 | 132 | </tr> |
@@ -1703,26 +1703,26 @@ export default defineComponent({ |
1703 | 1703 | const field = this.fields[colPos] |
1704 | 1704 | const name = field.name |
1705 | 1705 | setTimeout(() => { |
1706 | | - let sorting = field.sort |
| 1706 | + let sorting = field.sorting |
1707 | 1707 | if (sorting === null) { |
1708 | 1708 | if (field.type === 'number') |
1709 | 1709 | sorting = (a, b) => { |
1710 | | - if (Number(a[name]) > Number(b[name])) return 1 |
1711 | | - if (Number(a[name]) < Number(b[name])) return -1 |
| 1710 | + if (Number(a) > Number(b)) return 1 |
| 1711 | + if (Number(a) < Number(b)) return -1 |
1712 | 1712 | return 0 |
1713 | 1713 | } |
1714 | 1714 | else |
1715 | | - sorting = (a, b) => { |
1716 | | - return String(a[name]).localeCompare(String(b[name])) |
1717 | | - } |
| 1715 | + sorting = (a, b) => { |
| 1716 | + return String(a).localeCompare(String(b)) |
| 1717 | + } |
1718 | 1718 | } |
1719 | 1719 | this.modelValue.sort((a, b) => { |
1720 | | - return sorting(a, b) * -n |
| 1720 | + if (field.sort) return field.sort(a, b) * -n |
| 1721 | + else return sorting(a[name], b[name]) * -n |
1721 | 1722 | }) |
1722 | 1723 | this.sortPos = colPos |
1723 | 1724 | this.sortDir = n |
1724 | 1725 | this.refresh() |
1725 | | - // this.$forceUpdate() |
1726 | 1726 | this.processing = false |
1727 | 1727 | }, 0) |
1728 | 1728 | }, |
@@ -2492,9 +2492,9 @@ export default defineComponent({ |
2492 | 2492 | if (typeof colPos !== 'undefined') field = this.fields[colPos] |
2493 | 2493 | if (typeof recPos === 'undefined') recPos = this.pageTop + this.currentRowPos |
2494 | 2494 | if (typeof this.selected[recPos] !== 'undefined') |
2495 | | - this.updateSelectedRows(field, field.toValue(setText)) |
| 2495 | + this.updateSelectedRows(field, setText) |
2496 | 2496 | else |
2497 | | - this.updateCell(recPos, field, field.toValue(setText)) |
| 2497 | + this.updateCell(recPos, field, field.toValue(setText, this.table[recPos], field)) |
2498 | 2498 | }, |
2499 | 2499 | inputBoxBlur () { |
2500 | 2500 | if (!this.$refs.dpContainer) return |
@@ -2668,10 +2668,13 @@ export default defineComponent({ |
2668 | 2668 | }, 50) |
2669 | 2669 | }) |
2670 | 2670 | }, |
2671 | | - updateSelectedRows (field, content) { |
| 2671 | + updateSelectedRows (field, setText) { |
2672 | 2672 | this.processing = true |
2673 | 2673 | setTimeout(() => { |
2674 | | - Object.keys(this.selected).forEach(recPos => this.updateCell(parseInt(recPos), field, content)) |
| 2674 | + Object.keys(this.selected).forEach(recPos => { |
| 2675 | + const pos = parseInt(recPos) |
| 2676 | + this.updateCell(pos, field, field.toValue(setText, this.table[pos], field)) |
| 2677 | + }) |
2675 | 2678 | this.processing = false |
2676 | 2679 | }, 0) |
2677 | 2680 | }, |
|
0 commit comments