aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorOgnjen Cirkovic <ciraboxkg@gmail.com>2022-05-15 23:53:43 +0200
committerOgnjen Cirkovic <ciraboxkg@gmail.com>2022-05-15 23:53:43 +0200
commitdb4b8cead1c45dfc55d65942769f3ee33d6c369d (patch)
treeb8a3e96d15c3a24ccc10ed43068d58be66403b32 /frontend
parent11d83e1ea6c25a851b3eb7559ee85061d77337c9 (diff)
Omoguceni paging na tabeli.
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/app/_elements/form-dataset/form-dataset.component.html7
-rw-r--r--frontend/src/app/_elements/form-dataset/form-dataset.component.ts15
2 files changed, 16 insertions, 6 deletions
diff --git a/frontend/src/app/_elements/form-dataset/form-dataset.component.html b/frontend/src/app/_elements/form-dataset/form-dataset.component.html
index 7e836192..bce8f857 100644
--- a/frontend/src/app/_elements/form-dataset/form-dataset.component.html
+++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.html
@@ -47,9 +47,10 @@
<input class="file" id="file-upload" (change)="changeListener($event)" #fileInput type="file" accept=".csv">
<div class="mt-5 datatable">
- <button mat-button [ngClass]="{'hidden': !tableData.hasInput}" (click)="test()"><mat-icon>keyboard_arrow_left</mat-icon></button>
- <button mat-button [ngClass]="{'hidden': !tableData.hasInput}" (click)="test()"><mat-icon>keyboard_arrow_right</mat-icon></button>
-
+ <div class="">
+ <button mat-button [ngClass]="{'hidden': !tableData.hasInput}" (click)="goBack()"><mat-icon>keyboard_arrow_left</mat-icon></button>
+ <button mat-button [ngClass]="{'hidden': !tableData.hasInput}" (click)="goForward()"><mat-icon>keyboard_arrow_right</mat-icon></button>
+ </div>
<app-datatable [tableData]="tableData"></app-datatable>
</div>
diff --git a/frontend/src/app/_elements/form-dataset/form-dataset.component.ts b/frontend/src/app/_elements/form-dataset/form-dataset.component.ts
index 11d7faed..fd3637f9 100644
--- a/frontend/src/app/_elements/form-dataset/form-dataset.component.ts
+++ b/frontend/src/app/_elements/form-dataset/form-dataset.component.ts
@@ -42,8 +42,17 @@ export class FormDatasetComponent {
}
//@ViewChild('fileImportInput', { static: false }) fileImportInput: any; cemu je ovo sluzilo?
- test(){
- console.log("radi");
+ goBack(){
+ if(this.begin-10<=0)
+ this.begin=-1;
+ else
+ this.begin-=10;
+ this.loadExisting();
+
+ }
+ goForward(){
+ this.begin+=10;
+ this.loadExisting();
}
clear(){
this.tableData.hasInput = false;
@@ -100,7 +109,7 @@ export class FormDatasetComponent {
this.tableData.hasInput = true;
this.tableData.loaded = false;
- this.datasetsService.getDatasetFile(this.dataset.fileId).subscribe((file: string | undefined) => {
+ this.datasetsService.getDatasetFilePaging(this.dataset.fileId,this.begin,this.end).subscribe((file: string | undefined) => {
if (file) {
this.tableData.loaded = true;
this.tableData.numRows = this.dataset.rowCount;