scrollToCell on focus

This commit is contained in:
Faris Ansari 2017-12-29 15:32:41 +05:30
parent 41995adf6a
commit 0e6e9a7639
3 changed files with 20 additions and 5 deletions

View File

@ -109,10 +109,6 @@ export default class CellManager {
direction => keyboard.on('ctrl+' + direction, () => focusLastCell(direction))
);
['left', 'right', 'up', 'down'].map(
direction => keyboard.on(direction, () => this.scrollToCell(this.$focusedCell))
);
keyboard.on('esc', () => {
this.deactivateEditing();
});
@ -196,6 +192,7 @@ export default class CellManager {
$cell.classList.add('selected');
this.highlightRowColumnHeader($cell);
this.scrollToCell($cell);
}
highlightRowColumnHeader($cell) {

View File

@ -189,6 +189,19 @@ export default class DataManager {
}
return 0;
});
if (this.hasColumn('Sr. No')) {
// update Sr. No indexes
const srNoColIndex = this.getColumnIndex('Sr. No');
this.rows = this.rows.map((row, index) => {
return row.map(cell => {
if (cell.colIndex === srNoColIndex) {
cell.content = (index + 1) + '';
}
return cell;
});
});
}
}
reverseArray(array) {
@ -378,6 +391,10 @@ export default class DataManager {
hasColumn(name) {
return Boolean(this.columns.find(col => col.content === name));
}
getColumnIndex(name) {
return this.columns.findIndex(col => col.content === name);
}
}
function prepareRow(row, i) {

View File

@ -46,5 +46,6 @@ export default {
addCheckboxColumn: true,
enableClusterize: true,
enableLogs: false,
takeAvailableSpace: false
takeAvailableSpace: false,
loadingText: 'Loading...'
};