I was able to export filtered data across all pagination via uiGridExporterService service. Thanks to @Patricio's above answer for the hint.
//you can set it to ALL or VISIBLE or SELECTED
var columnsDownloadType = uiGridExporterConstants.ALL;
//get all the visible rows across all paginations
var filtered = _.filter(grid.api.grid.rows, function (o) {
return o.visible;
});
//get the entities of each of the filtered rows
var entities = _.map(filtered, 'entity');
//get all or visible column headers of this grid depending on the columnsDownloadType
var exportColumnHeaders = grid.options.showHeader ? uiGridExporterService.getColumnHeaders(grid, columnsDownloadType) : [];
var exportData = [];
/**this lodash for-each loop will covert the grid data into below array of array format
* [[{value:'row1col1value'},{value:'row1col2value'}],[{value:'row2col1value'},{value:'row2col2value'}].....]
* uiGridExporterService.formatAsCsv expects it in this format
**/
_.each(entities, function (row) {
var values = [];
_.each(exportColumnHeaders, function (column) {
var value = row[column.name];
values.push({value: value});
});
exportData.push(values);
});
//format the header,content in csv format
var csvContent = uiGridExporterService.formatAsCsv(exportColumnHeaders, exportData, ',');
//export as csv file
uiGridExporterService.downloadFile(grid.options.exporterCsvFilename, csvContent, grid.options.exporterOlderExcelCompatibility);