Search code examples
angularjsngtable

NgTable dynamic sorting depend on column


I am using ngTable to show data in table with pagination. But Now I want to add sorting on each column.

Does any on have an idea about it?


Solution

  • have a look at ngTable documentation - here and example here

     function demoController(NgTableParams, simpleList) {
        this.tableParams = new NgTableParams({
          // initial sort order
          sorting: { name: "asc" } 
        }, {
          dataset: simpleList
        });
      }