-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat(export): enhance Excel valueParserCallback
with dataContext & new demo
#1543
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1543 +/- ##
========================================
+ Coverage 99.8% 99.8% +0.1%
========================================
Files 198 198
Lines 21671 21680 +9
Branches 7241 7248 +7
========================================
+ Hits 21610 21619 +9
+ Misses 61 55 -6
- Partials 0 6 +6 ☔ View full report in Codecov by Sentry. |
@zewa666 Note that I was missing the cc @jr01 |
damn don't show this to my boss 🤣 need to take some proper time to check this PR out but so far this looks amazing |
@zewa666 cherry on top 🍒, I even got the demo to calculate Grouping Totals Sum (see both print screens above), your boss really shouldn't see this lol 🚀 However please note that it takes a fair amount of code to get it all working, I also assume that perf is probably impacted as well a bit, but anyway the point was to show that it's possible. I assume that generic functions and code reuse should help to decrease the number of lines, I know that I have repeated code and that is to keep it readable and understandable by the users who looks at the code. Also another thing to note, I got it working for Group Sum with 1 group level depth, it would be much harder to implement with multiple depth (and that has to be implemented by the user like in the new demo) Final note, I had to add couple more arguments to slickgrid-universal/packages/common/src/interfaces/columnExcelExportOption.interface.ts Lines 39 to 40 in 721f017
At this point, even Ag-Grid doesn't even provide such custom export, I should be paid a large amount of money for this feature, but to be fair I'm not even sure anyone would go that deep in their Excel export customization 😆 |
so much good stuff in this example. I didnt know about setting the metadata for excel exports. thats really great. where can I read up on the options? do you perhaps have a link? |
@zewa666 indeed you can do a lot with the cell value parser, I updated the associated cell value parser docs, you can find some info there. But I got a lot of these ideas when I migrated Excel-Builder to native code, for example the Excel Formulas I really got it from there when I read more about the metadata, so you'll get more info by going to the excel-builder-vanilla repo, read the docs and also try all the demos which I purposely made them WYSIWYG (what you see in the UI, you'll get in the export). In summary, whatever you can do in Excel-Builder, you should be able to do in SlickGrid as well 🚀 |
valueParserCallback
dataContext & new demovalueParserCallback
with dataContext & new demo
valueParserCallback
with dataContext & new demovalueParserCallback
with dataContext & new demo
excelExportOptions.valueParserCallback
was missing the dataContext which can be useful when the exported data is not the current cell value but another cell value, for example our cell is Total but is a calculated value from 2 other column dataContext (Price & Qty)excelExportOptions.style
wasn't being applied on regular data cellexcelExportOptions.valueParserCallback
)TODOs
excelExportOptions.filename
doesn't seem to work, need to investigategroupTotalsExcelExportOptions
which I had to improve to do everything I wanted in this demo :)use Excel Formulas to calculate Totals by using other dataContext props
use Excel Formulas to calculate Group Totals