angularjsangular-grid

How to do server-side sorting/filtering in angular-grid?


There is currently an open issue to add server-side sorting/filtering to the angular-grid project. Has anyone found a work-around to implement this functionality with the current grid implementation? Hacky or not, I'll still take it.


Solution

  • You can have more information here:

    http://www.ag-grid.com/angular-grid-virtual-paging/

    Any column can be sorted by clicking the header. When this happens, the datasource is called again with the new sort options.

    The columns Age, Country and Year can be filtered. When this happens, the datasource is called again with the new filtering options.

      $scope.gridOptions = {
            enableServerSideSorting: true,
            enableServerSideFilter: true
      }
      ...
      $scope.gridOptions.api.setDatasource(dataSource);
    

    The datasource has a getRows() which can use params.startRow and params.endRow, plus params.sortModel, params.filterModel to request the data from the server via an http call.