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

There is currently an open issue to add server side sorting / filtering to an angular-grid project. Has anyone found a workaround for implementing this functionality with the current mesh implementation? Hakki or not, I'll take it anyway.

+3


source to share


2 answers


You can get 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 data source is called again with the new collation.

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



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

      

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

+3


source


The documentation is here: https://www.ag-grid.com/javascript-grid-infinite-scrolling/ The Rowmodeltype should be set to infinite and the data-source pramater should be set instead of setRowData.

rowModelType : "infinite",
enableServerSideSorting: true,
enableServerSideFilter: true

      



Built-in filters like agSetColumnFilter, agTextColumnFilter, agNumberColumnFilter only work in ag grid versions 15.0.0 and 16.0.0, not working in version 14.2.0.

This is the plunkr for him: https://embed.plnkr.co/S2yZkGKF7utD1KEt1pbh/

0


source







All Articles