Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$scope.gridAPI.grid.rows not updating to match contents of $scope.gridOptions.data #5925

Closed
JMax2012 opened this issue Jan 5, 2017 · 5 comments

Comments

@JMax2012
Copy link

JMax2012 commented Jan 5, 2017

I have a hidden grid ("gridExport") whose purpose is only to consume large data sets and export the data to CSV.

When the user clicks the Export button, this code is executed -- I have indicated in the comments what the issue is:

myService.GetAllData().then(function (response) {
if (response) {

$scope.gridExport.data = response;

//debugger shows $scope.gridExport.data = Array[1000], correct amount of data

$scope.gridExportApi.exporter.csvExport('all', 'visible', myElement);

//debugger shows $scope.gridExportApi.grid.rows = Array[0]
//csv contains zero rows of data

}
});

Is there a way to force the grid api to "catch up" and refresh so that it is aware of the latest data set?

@JMax2012
Copy link
Author

JMax2012 commented Jan 5, 2017

To clarify, this issue is not impacted by the visibility or invisibility of the grid. I tested again on a visible grid, first loading just 100 rows of data, then attempting to batch-execute a load-and-export of 1000 rows.

First execute:

myService.GetPartialData(1,100).then(function (response) {
if (response) {

$scope.gridOptions.data = response;

//debugger shows $scope.gridOptions.data = Array[100], correct amount of data

}
});

Then execute:

myService.GetAllData().then(function (response) {
if (response) {

$scope.gridOptions.data = response;

//debugger shows $scope.gridOptions.data = Array[1000], correct amount of data

$scope.gridApi.exporter.csvExport('all', 'visible', myElement);

//debugger shows $scope.gridApi.grid.rows = Array[100]
//csv contains 100 rows of data

}
});

So in either case, $scope.gridApi is always one step behind after loading new data into $scope.gridOptions.data

@PaulL1
Copy link
Contributor

PaulL1 commented Jan 6, 2017 via email

@sergiomcalzada
Copy link

Hello, I have the same problem when using "exporterAllDataFn". When the promise resolves in the funcion "loadAllDataIfNeeded", the "grid.options.data" is a zero items array. So, "grid.modifyRows(grid.options.data)" is empty and the csv too

Any idea why?

@stale
Copy link

stale bot commented Jun 2, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 2, 2018
@stale
Copy link

stale bot commented Jul 2, 2018

This issue has been automatically closed because it has not had recent activity. If you believe that this is still an issue in the latest version, feel free to re-open it. Thank you for your contributions.

@stale stale bot closed this as completed Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants