Update sqlcmd table to use dataValues instead of deprecated data (#13121)

* Update sqlcmd table to use dataValues instead of deprecated data

* fix in declarativeTableComponent
This commit is contained in:
Kim Santiago
2020-10-29 13:19:59 -07:00
committed by GitHub
parent e15ad17967
commit 8c956cdb79
2 changed files with 9 additions and 4 deletions

View File

@@ -460,8 +460,7 @@ export class PublishDatabaseDialog {
const data = this.convertSqlCmdVarsToTableFormat(this.sqlCmdVars!); const data = this.convertSqlCmdVarsToTableFormat(this.sqlCmdVars!);
(<azdata.DeclarativeTableComponent>this.sqlCmdVariablesTable)!.updateProperties({ (<azdata.DeclarativeTableComponent>this.sqlCmdVariablesTable)!.updateProperties({
dataValues: data, dataValues: data
data: [] // data is deprecated, but the table gets updated incorrectly if this isn't set to an empty array
}); });
this.tryEnableGenerateScriptAndOkButtons(); this.tryEnableGenerateScriptAndOkButtons();
@@ -569,7 +568,7 @@ export class PublishDatabaseDialog {
const data = this.convertSqlCmdVarsToTableFormat(this.getSqlCmdVariablesForPublish()); const data = this.convertSqlCmdVarsToTableFormat(this.getSqlCmdVariablesForPublish());
await (<azdata.DeclarativeTableComponent>this.sqlCmdVariablesTable).updateProperties({ await (<azdata.DeclarativeTableComponent>this.sqlCmdVariablesTable).updateProperties({
data: data dataValues: data
}); });
if (Object.keys(result.sqlCmdVariables).length) { if (Object.keys(result.sqlCmdVariables).length) {

View File

@@ -139,7 +139,13 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
private onCellDataChanged(newValue: string | number | boolean | any, rowIdx: number, colIdx: number): void { private onCellDataChanged(newValue: string | number | boolean | any, rowIdx: number, colIdx: number): void {
this.data[rowIdx][colIdx].value = newValue; this.data[rowIdx][colIdx].value = newValue;
this.setPropertyFromUI<any[][]>((props, value) => props.data = value, this.data);
if (this.properties.data) {
this.setPropertyFromUI<any[][]>((props, value) => props.data = value, this.data);
} else {
this.setPropertyFromUI<any[][]>((props, value) => props.dataValues = value, this.data);
}
let newCellData: azdata.TableCell = { let newCellData: azdata.TableCell = {
row: rowIdx, row: rowIdx,
column: colIdx, column: colIdx,