fix: add abiltiy to copy total row (#204)
This commit is contained in:
parent
ba9814228d
commit
f05049c67a
@ -20,7 +20,8 @@ export default class CellManager {
|
|||||||
'columnmanager',
|
'columnmanager',
|
||||||
'rowmanager',
|
'rowmanager',
|
||||||
'datamanager',
|
'datamanager',
|
||||||
'keyboard'
|
'keyboard',
|
||||||
|
'footer'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.bindEvents();
|
this.bindEvents();
|
||||||
@ -172,6 +173,14 @@ export default class CellManager {
|
|||||||
mouseDown = false;
|
mouseDown = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.options.showTotalRow) {
|
||||||
|
$.on(this.footer, 'click', '.dt-cell', (e) => {
|
||||||
|
|
||||||
|
this.focusCell($(e.delegatedTarget));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const selectArea = (e) => {
|
const selectArea = (e) => {
|
||||||
if (!mouseDown) return;
|
if (!mouseDown) return;
|
||||||
this.selectArea($(e.delegatedTarget));
|
this.selectArea($(e.delegatedTarget));
|
||||||
@ -552,10 +561,18 @@ export default class CellManager {
|
|||||||
// copy only focusedCell
|
// copy only focusedCell
|
||||||
const {
|
const {
|
||||||
colIndex,
|
colIndex,
|
||||||
rowIndex
|
rowIndex,
|
||||||
|
isTotalRow
|
||||||
} = $.data($cell1);
|
} = $.data($cell1);
|
||||||
|
let copiedContent = '';
|
||||||
|
if (isTotalRow) {
|
||||||
|
let choosenFooterCell = this.$focusedCell;
|
||||||
|
copiedContent = choosenFooterCell.children[0].title;
|
||||||
|
} else {
|
||||||
const cell = this.getCell(colIndex, rowIndex);
|
const cell = this.getCell(colIndex, rowIndex);
|
||||||
copyTextToClipboard(cell.content);
|
copiedContent = cell.content;
|
||||||
|
}
|
||||||
|
copyTextToClipboard(copiedContent);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const cells = this.getCellsInRange($cell1, $cell2);
|
const cells = this.getCellsInRange($cell1, $cell2);
|
||||||
@ -754,7 +771,7 @@ export default class CellManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scrollToCell($cell) {
|
scrollToCell($cell) {
|
||||||
if ($.inViewport($cell, this.bodyScrollable)) return false;
|
if ($.inViewport($cell, this.bodyScrollable) || $.inViewport($cell, this.footer)) return false;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
rowIndex
|
rowIndex
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user