esvit / ng-table

Simple table with sorting and filtering on AngularJS
http://esvit.github.io/ng-table
BSD 3-Clause "New" or "Revised" License
2.77k stars 851 forks source link

How to sort at the initial page load. #1022

Open dilshankm opened 6 years ago

dilshankm commented 6 years ago

I need a list to be sorted at the initial page load.But sorting seems only working when i click the sorting arrows. Is it possible list to be sorted at initial page load.

oleks-fedotov commented 6 years ago

You can do that by specifying sorting option as initial value for NgTableParams:

new NgTableParams({
        filter: requestQueryParameters.filter,
        sorting: requestQueryParameters.sort,
        count: requestQueryParameters.recordsPerPage,
        page: requestQueryParameters.page
    },
    {
        dataset: [.....]
    }
});