Hello I have a problem with ui-grid. When I do a sync call on my Api, the code passes through the onRegisterApi in the $scope.gridOptions.
But If I put the call in Async, It don't pass in the onRegisterApi and $scope.gridApi is undefened so I loose my filters.
Here is my definition of GridOptions :
$scope.gridOptions = {
colDef = colDef,
data = $scope.rowCollection,
enableGridMenu: true,
enableFiltering: true,
onRegisterApi: function (gridApi) {
debugger; //Don't pass here with async call
$scope.gridApi = gridApi;
}
}
Here is the begining of my api call :
$.ajax({
url: Api.getHost() + "url/" + $scope.currentObjectType,
async: true,
type: "GET",
datatype: "jsonp",
contentType: "application/json",
data: { page: $scope.page, number: $scope.number },
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + Api.getToken());
},
$httpservice instead. There are some examples here link