admin管理员组文章数量:1313085
We have a ng-grid which displays data retrieved from a rest service. I want to export the rows selected by user(ng-grid selection check box enabled) to an excel and open that excel. The current behavior of app is Export to excel button calling a rest service with selected items from ng-grid and using POI to put the data into excel and returning the excel.
Is there a better way to do this? The data is already in browser, is there any angularjs, jQuery or javascript function to do this?
We have a ng-grid which displays data retrieved from a rest service. I want to export the rows selected by user(ng-grid selection check box enabled) to an excel and open that excel. The current behavior of app is Export to excel button calling a rest service with selected items from ng-grid and using POI to put the data into excel and returning the excel.
Is there a better way to do this? The data is already in browser, is there any angularjs, jQuery or javascript function to do this?
Share Improve this question asked Oct 9, 2013 at 4:53 AyanAyan 5454 gold badges9 silver badges20 bronze badges 1- Maybe this topic can help – Nikos Paraskevopoulos Commented Oct 9, 2013 at 6:57
1 Answer
Reset to default 5There is a plugin for csv export : https://github./angular-ui/ng-grid/tree/master/plugins
It can be easily added by adding it to your gridoptions, while making sure to display the footer.
$scope.gridOptions = {
data: ...,
plugins: [new ngGridCsvExportPlugin()],
showFooter: true,
...
};
It exports all your records from your specified grid.data.
[Although you can pass in an options object for specifying columns etc. there isn't an option currently to limit to selectedItems.]
It looks easy though to adjust the ng-grid-csv-export.js source to loop over grid.mySelections instead over grid.data. (not tested by me yet)
本文标签: javascriptAngularJS nggrid Export to Excel for selectedItemsStack Overflow
版权声明:本文标题:javascript - AngularJS ng-grid Export to Excel for selectedItems - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741924746a2405216.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论