I am currently working with ui-grid and implementing server-side filtering. I make a request to the API for each column based on the filter value, with the default parameter being empty.
var filterOptions = {
filterBy: '&$filter=',
filterParam: ""
};
// The API call is structured like this
?$orderby=id-&pageSize=250&pageNbr=1&$filter=
If any filter is applied, the next request will be sent like this
param: filterOptions.filterParam = 'eventTypeId==' + evtTypeId
request: ?$orderby=id-&pageSize=250&pageNbr=1&$filter=eventTypeId==2
My objective is simple - I want to detect if a filter is already in place and send a request similar to this
?$orderby=id-&pageSize=250&pageNbr=1&$filter=eventTypeId==2,studyId==1
Unfortunately, I am unable to identify any applied filters. Any assistance would be greatly appreciated.
Below is my code snippet:
Column Definitions
$scope.gridOptions.columnDefs = [
{
field: 'title',
cellClass: getCellClass,
useExternalFiltering: true
}, {
field: 'description',
cellClass: getCellClass,
enableFiltering: true,
useExternalFiltering: true
},
// Additional column definitions...
];
RegisterApi
$scope.gridOptions.onRegisterApi = function (gridApi) {
// Defined behaviors for grid interactions
};
Where getData() Function Definition
var getData = function () {
// Functionality of fetching data from the API and updating the grid view
};
Link to my Plunker demo (API details cannot be provided)