From 61f21c866a2d6d95e65d5b61d0df8be865963262 Mon Sep 17 00:00:00 2001 From: Ognjen Cirkovic Date: Mon, 16 May 2022 22:39:03 +0200 Subject: Omogucen praging na tabeli koja se nalazi na stranici gde se kreira eksperiment. --- .../column-table/column-table.component.html | 6 ++++ .../column-table/column-table.component.ts | 36 +++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) (limited to 'frontend/src/app/_elements/column-table') diff --git a/frontend/src/app/_elements/column-table/column-table.component.html b/frontend/src/app/_elements/column-table/column-table.component.html index 9aebf114..3256ffee 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.html +++ b/frontend/src/app/_elements/column-table/column-table.component.html @@ -44,6 +44,12 @@ +
+ +
{{(this.begin/10)+1}}
+ + +
diff --git a/frontend/src/app/_elements/column-table/column-table.component.ts b/frontend/src/app/_elements/column-table/column-table.component.ts index e9154cb3..b160ab30 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.ts +++ b/frontend/src/app/_elements/column-table/column-table.component.ts @@ -42,9 +42,30 @@ export class ColumnTableComponent implements AfterViewInit { loaded: boolean = false; + begin:number=0; + end:number=10; + + + constructor(private datasetService: DatasetsService, private experimentService: ExperimentsService, public csvParseService: CsvParseService, public dialog: MatDialog) { //ovo mi nece trebati jer primam dataset iz druge komponente } + resetPagging(){ + this.begin=0; + } + goBack(){ + if(this.begin-10<=0) + this.begin=0; + else + this.begin-=10; + this.loadData(); + + } + goForward(){ + this.begin+=10; + this.loadData(); + } + updateCharts() { //min: number, max: number, q1: number, q3: number, median: number @@ -90,16 +111,21 @@ export class ColumnTableComponent implements AfterViewInit { this.dataset.columnInfo.forEach(colInfo => { this.nullValOption.push(`ObriĊĦi redove (${colInfo.numNulls})`); }); + this.resetPagging(); + this.loadData(); + this.loaded = true; + + this.updateCharts(); + this.updatePieChart(); + } - this.datasetService.getDatasetFilePartial(this.dataset.fileId, 0, 10).subscribe((response: string | undefined) => { + loadData(){ + if(this.dataset!=undefined) + this.datasetService.getDatasetFilePartial(this.dataset.fileId, this.begin, this.end).subscribe((response: string | undefined) => { if (response && this.dataset != undefined) { this.tableData = this.csvParseService.csvToArray(response, (this.dataset.delimiter == "razmak") ? " " : (this.dataset.delimiter == "novi red") ? "\t" : this.dataset.delimiter); } }); - this.loaded = true; - - this.updateCharts(); - this.updatePieChart(); } ngAfterViewInit(): void { -- cgit v1.2.3