First, thank you @Atmos206 for the excellent work on ui-grid-custom-cell-select.
I'm using it in a project where I needed to include column headers by default. I simply patched the ui-grid-custom-cell-select directive for my purposes.
It's not a general solution since you might want to have an option to include headers or not (maybe a configurable provider) rather than include headers by default. And I did modify the copyData array assignment, which I probably shouldn't do.
In any case, I thought I'd briefly share the added code here FWIW. Perhaps someone might have a use for it as a quick and dirty option.
I'm a newbie, so any comments on the code or obvious bugs to be pointed out are welcome.
// copy headers from selected cells into copyData array,, then add the cells' data
_scope.ugCustomSelect.copyData = createCopyHeaders(indexMap.col.start, indexMap.col.end)
_scope.ugCustomSelect.copyData += createCopyData(_scope.ugCustomSelect.selectedCells,
// copy headers fn
function createCopyHeaders(colStart, colEnd){
var visibleCols = grid.renderContainers.body.renderedColumns;
var numCols = colEnd - colStart;
var columnHeaders = ''
for (var ci = colStart; ci <= colEnd; ci++) {
var currentCol = visibleCols[ci];
columnHeaders += currentCol.displayName;
if (ci !== colEnd) {
columnHeaders += '\t';
}
}
return columnHeaders + '\n';
}
First, thank you @Atmos206 for the excellent work on ui-grid-custom-cell-select.
I'm using it in a project where I needed to include column headers by default. I simply patched the ui-grid-custom-cell-select directive for my purposes.
It's not a general solution since you might want to have an option to include headers or not (maybe a configurable provider) rather than include headers by default. And I did modify the copyData array assignment, which I probably shouldn't do.
In any case, I thought I'd briefly share the added code here FWIW. Perhaps someone might have a use for it as a quick and dirty option.
I'm a newbie, so any comments on the code or obvious bugs to be pointed out are welcome.