Skip to content

Commit 646d265

Browse files
split data loading into initial 10K read and subsequent add data requests after initial table is created (#50)
1 parent 149c27d commit 646d265

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/views/tableView.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ export class TableView {
219219
if (rowCount === this._pageDataSize) {
220220
// send initial set of data rows to table view for display
221221
this.loadData(tableRows);
222+
// stop reading data
223+
// dataStream.destroy();
222224
}
223225
});
224226

@@ -228,6 +230,13 @@ export class TableView {
228230
// load first page of data
229231
this.loadData(tableRows);
230232
}
233+
else if (tableRows.length >= this._pageDataSize) {
234+
// load remaining table rows
235+
this._tableData = tableRows;
236+
this._totalRows = this._tableData.length;
237+
const dataPageIndex: number = 1;
238+
this.addData(dataPageIndex);
239+
}
231240
});
232241
}
233242

@@ -240,6 +249,7 @@ export class TableView {
240249
// save table data for incremental load into table view
241250
this._tableData = tableRows;
242251
this._totalRows = this._tableData.length;
252+
this.logTableData(tableRows);
243253

244254
// send initial set of data rows to table view for display
245255
const initialDataRows: Array<any> = tableRows.slice(0, Math.min(this._pageDataSize, this._totalRows));
@@ -260,6 +270,7 @@ export class TableView {
260270
*/
261271
public async addData(dataPage: number): Promise<void> {
262272
const nextRows: number = dataPage * this._pageDataSize;
273+
console.log(`tabular.data.view:addData(): loading rows ${nextRows}+ ...`);
263274
if (nextRows < this._totalRows) {
264275
// get the next set of data rows to load in table view
265276
const dataRows: Array<any> =

0 commit comments

Comments
 (0)