hjalmers / angular-generic-table

A generic table for Angular 2+. Generic table uses standard markup for tables ie. table, tr and td elements etc. and has support for expanding rows, global search, filters, sorting, pagination, export to CSV, column clicks, custom column rendering, custom export values.
https://hjalmers.github.io/angular-generic-table/
MIT License
105 stars 55 forks source link

Sorting is not working... #272

Closed rcanpahali closed 1 year ago

rcanpahali commented 5 years ago

Hello, my code is below:

`

<generic-table #table1 [gtSettings]="gt.settings" [gtClasses]="'small'" [gtInfo]="gt.info" [gtOptions]="gtOptions" [gtFields]="gt.fields" [(gtData)]="gt.data" (gtEvent)="trigger($event)"> <ng-template [ngIf]="isLoading">

Hesaplar listeleniyor...

        </ng-template>
        <div class="text-center">
            <gt-pagination [gtClasses]="'justify-content-center'" [genericTable]="table1"></gt-pagination>
        </div>
    </div>`

And i enabled sorting for this column:

{ objectKey: 'accNo', sort: 'enable', columnOrder: 1 },

When I click on column, I console log the $event:

image

It seems like something happening but no change in my table.

I'm doing something wrong but don't know the reason. Thanks.

hjalmers commented 5 years ago

It might be the format of your data, is accNo a string or number? Can you reproduce it in stackblitz?

Liahus3003 commented 5 years ago

I am facing this same issue as well, we are getting $$gtInitialRowIndex as the event for 3rd click, Expected: accNo -> -accNo -> accNo Actual : accNo -> -accNo -> $$gtInitialRowIndex

Shouldn't this be an option rather than being forced ?

hjalmers commented 5 years ago

@Liahus3003 check #250, since 4.16 it’s possible to configure the sorting behavior using allowUnsorted option.