Use max column width when auto-sizing columns (#4394)

This commit is contained in:
Matt Irvine
2019-03-12 14:03:37 -07:00
committed by GitHub
parent 53a94cc7bb
commit e783aeab66
4 changed files with 9 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ export interface IAutoColumnSizeOptions extends Slick.PluginOptions {
}
const defaultOptions: IAutoColumnSizeOptions = {
maxWidth: 200,
maxWidth: 212,
autoSizeOnRender: false
};
@@ -146,7 +146,7 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
let template = this.getMaxTextTemplate(texts, columnDef, colIndex, data, rowEl);
let width = this.getTemplateWidth(rowEl, template);
this.deleteRow(rowEl);
return width;
return width > this._options.maxWidth ? this._options.maxWidth : width;
}
private getTemplateWidth(rowEl: JQuery, template: JQuery | HTMLElement): number {