Set rowIndex width based on rowCount
This commit is contained in:
parent
a467d164a9
commit
7bac878a84
13
dist/frappe-datatable.cjs.js
vendored
13
dist/frappe-datatable.cjs.js
vendored
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
13
dist/frappe-datatable.js
vendored
13
dist/frappe-datatable.js
vendored
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
@ -65,8 +65,7 @@ export default class DataManager {
|
||||
editable: false,
|
||||
resizable: false,
|
||||
focusable: false,
|
||||
dropdown: false,
|
||||
width: 30
|
||||
dropdown: false
|
||||
};
|
||||
|
||||
this.columns.push(cell);
|
||||
|
||||
10
src/style.js
10
src/style.js
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user