2
votes

I'm using ng2-smart-table in my angular application. Since we are dealing with massive amount of data, I implemented pagination infrastructure and used ServerDataSource instead of LocalDataSource.

Everything works fine until it comes to sorting the data, I don't know how to elegantly capture the sorting event and send to the server the sorting (by which column, asc/desc) request, and unfortunately the documentation didn't help as well.

my ng2-smart-table settings:

public settings: any = {
pager: {
  display: true,
  perPage: this.itemsPerPage
},
actions: "false",
sort:true,
hideSubHeader: "true",
columns: {} //will be generated dynamically by the data

};

my ng2-smart-table component:

<ng2-smart-table
    class="report-table"
    [settings]="settings"
    [source]="serverDataSource">
 </ng2-smart-table>

any one has any suggestions?

thank you

1

1 Answers

0
votes

Ng2-smart-table doesn’t seem to provide any sort event handler.

Moreover, have you seen it on the associated github?

Low Maintenance

Due to project priority and resource constraints, this project is currently on low maintenance. We recognize that there are a lot of activities around this package. However, we are unable to accommodate the maintenance this project requires.

I think you should swap to other table like angular material table that provide anything you need and is still under maintenance. You can check https://material.angular.io/components/table/overview It is pretty simple to use and well documented.