fixed several model view issues (#1640)

* fixed several model view issues
This commit is contained in:
Leila Lali
2018-06-15 16:59:12 -07:00
committed by GitHub
parent ab39f1f44f
commit a225925bc4
18 changed files with 238 additions and 130 deletions

View File

@@ -127,13 +127,19 @@ export default class TableComponent extends ComponentBase implements IComponent,
/// IComponent implementation
public layout(): void {
this._table.layout(new Dimension(
this.width ? this.width : getContentWidth(this._inputContainer.nativeElement),
this.height ? this.height : getContentHeight(this._inputContainer.nativeElement)));
this.layoutTable();
this._changeRef.detectChanges();
}
private layoutTable(): void {
let width: number = this.convertSizeToNumber(this.width);
let height: number = this.convertSizeToNumber(this.height);
this._table.layout(new Dimension(
width && width > 0 ? width : getContentWidth(this._inputContainer.nativeElement),
height && height > 0 ? height : getContentHeight(this._inputContainer.nativeElement)));
}
public setLayout(): void {
// TODO allow configuring the look and feel
this.layout();
@@ -149,10 +155,8 @@ export default class TableComponent extends ComponentBase implements IComponent,
if (this.selectedRows) {
this._table.setSelectedRows(this.selectedRows);
}
this._table.layout(new Dimension(
this.width ? this.width : getContentWidth(this._inputContainer.nativeElement),
this.height ? this.height : getContentHeight(this._inputContainer.nativeElement)));
this.layoutTable();
this.validate();
}
@@ -181,20 +185,4 @@ export default class TableComponent extends ComponentBase implements IComponent,
public set selectedRows(newValue: number[]) {
this.setPropertyFromUI<sqlops.TableComponentProperties, number[]>((props, value) => props.selectedRows = value, newValue);
}
public get height(): number {
return this.getPropertyOrDefault<sqlops.TableComponentProperties, number>((props) => props.height, undefined);
}
public set height(newValue: number) {
this.setPropertyFromUI<sqlops.TableComponentProperties, number>((props, value) => props.height = value, newValue);
}
public get width(): number {
return this.getPropertyOrDefault<sqlops.TableComponentProperties, number>((props) => props.width, undefined);
}
public set width(newValue: number) {
this.setPropertyFromUI<sqlops.TableComponentProperties, number>((props, value) => props.width = value, newValue);
}
}