diff --git a/src/sql/base/browser/ui/table/table.ts b/src/sql/base/browser/ui/table/table.ts index c9aa34957b..44a16231bb 100644 --- a/src/sql/base/browser/ui/table/table.ts +++ b/src/sql/base/browser/ui/table/table.ts @@ -67,13 +67,13 @@ export class Table extends Widget implements IThemabl constructor(parent: HTMLElement, configuration?: ITableConfiguration, options?: Slick.GridOptions) { super(); - if (!configuration || isArray(configuration.dataProvider)) { + if (!configuration || !configuration.dataProvider || isArray(configuration.dataProvider)) { this._data = new TableDataView(configuration && configuration.dataProvider as Array); } else { this._data = configuration.dataProvider; } - if (configuration.columns) { + if (configuration && configuration.columns) { this._columns = configuration.columns; } else { this._columns = new Array>(); @@ -105,7 +105,7 @@ export class Table extends Widget implements IThemabl this._grid = new Slick.Grid(this._tableContainer, this._data, this._columns, newOptions); this.idPrefix = this._tableContainer.classList[0]; DOM.addClass(this._container, this.idPrefix); - if (configuration.sorter) { + if (configuration && configuration.sorter) { this._sorter = configuration.sorter; this._grid.onSort.subscribe((e, args) => { this._sorter.sort(args); diff --git a/src/sql/parts/profiler/editor/controller/profilerTableEditor.ts b/src/sql/parts/profiler/editor/controller/profilerTableEditor.ts index f4b5dfec38..d4bfe959aa 100644 --- a/src/sql/parts/profiler/editor/controller/profilerTableEditor.ts +++ b/src/sql/parts/profiler/editor/controller/profilerTableEditor.ts @@ -72,7 +72,16 @@ export class ProfilerTableEditor extends BaseEditor implements IProfilerControll this._overlay.style.zIndex = '4'; parent.appendChild(this._overlay); - this._profilerTable = new Table(parent); + this._profilerTable = new Table(parent, { + sorter: { + sort: (args) => { + let input = this.input as ProfilerInput; + if (input && input.data) { + input.data.sort(args); + } + } + } + }); this._profilerTable.setSelectionModel(new RowSelectionModel()); attachTableStyler(this._profilerTable, this._themeService);