svelte-headless-table icon indicating copy to clipboard operation
svelte-headless-table copied to clipboard

Plugin 'addDataExport' - incorrect export of parent/ child hierarchy

Open BlueFoxPrime opened this issue 3 years ago • 4 comments

Hi :)

I noticed that the plugin does not seem to output parent/ child hierarchy correctly when choosing type 'object': image

Expected behaviour in this case would be the that there are 2 top level objects instead of 6, when expanded. Example RPL

In case the error is on my end.. please give me a hint. Your awesome work is very much appreciated!

BlueFoxPrime avatar Sep 30 '22 11:09 BlueFoxPrime

Hey @BlueFoxPrime, unfortunately this was a decision that I decided to make for the data export plugin.

My reasoning was that the export plugin is primarily concerned with exporting data as it looks in the table.

However, if there's a need for it, I can look into extending the plugin with an option to preserve nesting?

bryanmylee avatar Sep 30 '22 13:09 bryanmylee

@BlueFoxPrime Let me know if the nested behavior is what you need, and if the use case is common enough I'll work on adding an option to enable such a feature!

bryanmylee avatar Oct 07 '22 06:10 bryanmylee

Hey, sorry for the late response but I am on holiday :)

I think that the use case is quite common because I want to share data to other component(s) depending on what’s displayed in the table. The way it’s designed produces strange results, as children are also displayed as parent items. I did some minor modifications to the ‘addDataExport’ plugin to change it. I didn’t manage to test it yet but it seems to work just fine. I can post the code when I get back.

BlueFoxPrime avatar Oct 07 '22 18:10 BlueFoxPrime

Hey @BlueFoxPrime, that sounds great!

Most of the plugins are missing a lot of test coverage at the moment. If you open a PR, I'll gladly write the testcases for it.

bryanmylee avatar Oct 08 '22 02:10 bryanmylee

@BlueFoxPrime Let me know if there's any update on this! Otherwise, we'll mark this as resolved for now. Feel free to re-open the issue if necessary.

bryanmylee avatar Dec 22 '22 08:12 bryanmylee