EvHaus / doby-grid

An HTML table element on steroids.
Other
14 stars 5 forks source link

Add ability to export group #168

Closed mminer closed 9 years ago

mminer commented 9 years ago

This adds an option to export a group instead of the entire table, as requested in #84.

Before merging in, the UX should perhaps be considered. This adds two options to the Export context submenu: Export Group to CSV and Export Group to HTML. These only appear when grouping has been turned on. This works alright, but there's also a Grouping submenu that could also hold these options. The place they appear now makes the most sense to me, but I can move them elsewhere if desired.

Code-wise, the way I tell export to only export a group may seem a bit strange. I pass it the row that the group is on then later call getGroupFromRow to get the underlying group. Initially I passed the group itself (also retrieved via getGroupFromRow) as an argument to export, which makes more sense, but when remotely fetching rows these will contain placeholders and you have to "re-get" the group anyway. Getting the group from the clicked row inside export is currently the most elegant way to do this.