add a story to the docs - export to excel #22
shlomiassaf
started this conversation in
New Features
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Exporting to excel is not bundled with
@pebula/ngrid
because it's not really essential to the core.However, it's not really hard to implement and until (and if) we have some plugin package for that we should demo how to do it.
Basically once you have a data source and a column definition set you have all that is required to export, just pick your medium.
From there we can throw all kinds of options to the implementation, like pre-export transformation, excluded columns, virtual columns and so on.
Each cell is exported using the row and the column instance so crazy customizations can be done just by providing a different column set.
I've already implemented this at work, by creating a plugin directive which of course has access to the grid and so has access to the datasource and column definition set.
pblExcelExport
is the directive, which gets options (here viaexportOptions
) which contains the columns, data and other stuff.Internally it will use them to create the excel using the excel library we use at work. We even support server side pagination with automated "consume" to get all results and then export (will not be in demo)
It's not hard to get access to the instance of
pblExcelExport
to execute the export but there are other ways it can get triggered.Furthermore, the buttons to invoke an export are set in an action row in my setup, but any other way can work.
We can use any library that is allowed to be included in an open-source project.
Or maybe, for the sake of demo, just export to CSV.
Sometime in the future this might become a plugin package...
Beta Was this translation helpful? Give feedback.
All reactions