var startCell= {rowIndex:
rowIndex, colIndex: 0}, endCell= {rowIndex:
rowIndex, colIndex: 0};
excelObj.deleteShiftUp(startCell, endCell);
For some reason a loss is happening when the functionality occurs:
i.e.
Value 1 |
Value 2 |
Value 3 |
Value 4 |
Value 5 |
Value 6 |
If you were to delete 'Value 3' the proceeding values would shift up but an empty cell is left. See below for example after.. That's why we were just trying to edit after the fact (excelObj.XLEdit.updateCellValue({ rowIndex: rowIndex, colIndex: 0 }, somethingInCellBelow);). 'Value 4' gets "lost".
Value 1 |
Value 2 |
Value 5 |
Value 6 |
I should also add we'll need a whole range of cells to shift up if not the entire row. Sample data:
Value 1 | 2 | |||||
Value 2 | 1 | 1 | ||||
Value 3 | 1 | 1 | 1 | 1 | ||
Value 4 | 1 | 1 | ||||
Value 5 | 1 | 1 | 1 | |||
Value 6 | 1 | 1 | 1 | 1 |
Desired display after deleting row or shifting cells:
Value 1 | 2 | |||||
Value 2 | 1 | 1 | ||||
Value 4 | 1 | 1 | ||||
Value 5 | 1 | 1 | 1 | |||
Value 6 | 1 | 1 | 1 | 1 |
Thank you for your assistance!
$(function () {
$("#Spreadsheet").ejSpreadsheet({
sheets: [
{ dataSource: defaultData, showHeader: false }
],
columnWidth: 90,
// cellSave: "delClick"
actionComplete: "delClick"
});
});
function delClick(args) {
var excelObj = $("#Spreadsheet").data("ejSpreadsheet");
if (args.reqType == "edit") { // for cell edit operation
if (args.cValue.length === 0 && args.pValue.length > 0)
{
// condition for current and previous cell value length
excelObj.deleteEntireRow(args.rowIndex, args.rowIndex); // to delete the row
}
}
}
|