1

I have angular's ui-grid implemented along with infinite scroll enabled. Currently it only fetches 100 rows at a time - when I enable export to csv in the grid options, by default it will export only how many rows are visible. My question, is there a way to export but get all rows of data? Any input/suggestions are appreciated.

1
  • i know there is an option to export "all data" and export "visible" but within the export all data - do I need to make a call to retrieve the full data list? Commented Jul 6, 2016 at 14:44

1 Answer 1

2

I had the same issue back in months and I found this solution :

From the documentation, you can use exporterAllDataFn property in $scope.gridOptions

gridOptions.exporterAllDataFn = function () {
  return $http.get('/data/100.json')
}

As far as I unsterstood, this function is called once you clicked on the exporterMenuCsv menu button 'Export all data as csv'

I also found this good tutorial made by PaulL1, major contributor of the ui-grid lib.

Note: I quickly ended up not using this solution: I wanted to add some formatting/filtering/sorting on each columns, so I made my own export function.

Hope it helps

Sign up to request clarification or add additional context in comments.

2 Comments

I have filtering and sorting built in also, do you mind sharing an example of the export function you added? Basically on my dto i have a parameter: isPaged: true - that is calling a different repository method to run paging and only return 100 at a time - so in my new function I'll need to pass the grid dto with isPaged: false so it calls the getAll method which will return the full result set on export
Sharing my code won't be usefull I guess. But here is what I did : - Created a service 'dataExportServices' In which you can find a function where you make your call to retrieve all data and your filtering/sorting/formatting functions. - I created a graphical component that call this export function in the service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.