remove updating row number column size (#3756)

This commit is contained in:
Anthony Dresser
2019-01-22 14:37:59 -08:00
committed by GitHub
parent eb0b2a847b
commit d5176e0eb7
2 changed files with 2 additions and 13 deletions

View File

@@ -15,7 +15,6 @@ const sizePerDigit = 15;
export class RowNumberColumn<T> implements Slick.Plugin<T> {
private handler = new Slick.EventHandler();
private grid: Slick.Grid<T>;
private currentColumnWidth: number;
constructor(private options: IRowNumberColumnOptions) {
}
@@ -50,23 +49,14 @@ export class RowNumberColumn<T> implements Slick.Plugin<T> {
}
}
public updateRowCount(rowNum: number) {
this.options.numberOfRows = rowNum;
let columnWidth = Math.max(this.options.numberOfRows.toString().length * sizePerDigit, 22);
if (columnWidth !== this.currentColumnWidth) {
this.grid.setColumnWidths([this.getColumnDefinition()]);
}
}
public getColumnDefinition(): Slick.Column<T> {
// that smallest we can make it is 22 due to padding and margins in the cells
this.currentColumnWidth = Math.max(this.options.numberOfRows.toString().length * sizePerDigit, 22);
return {
id: 'rowNumber',
name: '',
field: 'rowNumber',
width: this.currentColumnWidth,
resizable: false,
width: 22,
resizable: true,
cssClass: this.options.cssClass,
focusable: false,
selectable: false,