Set rowIndex width based on rowCount

This commit is contained in:
Faris Ansari 2018-02-23 15:04:18 +05:30
parent a467d164a9
commit 7bac878a84
4 changed files with 33 additions and 6 deletions

View File

@ -880,8 +880,7 @@ class DataManager {
editable: false,
resizable: false,
focusable: false,
dropdown: false,
width: 30
dropdown: false
};
this.columns.push(cell);
@ -2770,6 +2769,16 @@ class Style {
const column = this.datamanager.getColumn(colIndex);
let naturalWidth = $.style($('.content', $cell), 'width');
if (column.id === '_rowIndex') {
// width based on rowCount
const rowCount = this.datamanager.getRowCount();
const digits = (rowCount + '').length;
if (digits > 2) {
naturalWidth = naturalWidth + ((digits - 2) * 8);
}
}
column.naturalWidth = naturalWidth;
});
}

View File

@ -879,8 +879,7 @@ class DataManager {
editable: false,
resizable: false,
focusable: false,
dropdown: false,
width: 30
dropdown: false
};
this.columns.push(cell);
@ -2769,6 +2768,16 @@ class Style {
const column = this.datamanager.getColumn(colIndex);
let naturalWidth = $.style($('.content', $cell), 'width');
if (column.id === '_rowIndex') {
// width based on rowCount
const rowCount = this.datamanager.getRowCount();
const digits = (rowCount + '').length;
if (digits > 2) {
naturalWidth = naturalWidth + ((digits - 2) * 8);
}
}
column.naturalWidth = naturalWidth;
});
}

View File

@ -65,8 +65,7 @@ export default class DataManager {
editable: false,
resizable: false,
focusable: false,
dropdown: false,
width: 30
dropdown: false
};
this.columns.push(cell);

View File

@ -124,6 +124,16 @@ export default class Style {
const column = this.datamanager.getColumn(colIndex);
let naturalWidth = $.style($('.content', $cell), 'width');
if (column.id === '_rowIndex') {
// width based on rowCount
const rowCount = this.datamanager.getRowCount();
const digits = (rowCount + '').length;
if (digits > 2) {
naturalWidth = naturalWidth + ((digits - 2) * 8);
}
}
column.naturalWidth = naturalWidth;
});
}