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
Easier way create table from nested properties #258
Comments
@simonbengtsson I had another follow up question regarding this, and I thought it better to ask here, than on the Stackoverflow question. If this is not the correct place, then please let me know. While waiting for this feature to get implemented, I am using the approach that you suggested in the SO post. This is what I am currently doing...
Where the format of the JSON coming back is this:
To extract the information in the createdCell method, I am then trying this:
which is an extension of the example that you showed. However, the output in the table is: When I was expecting it to be
While debugging, I can see that CUSTOMER_A is correctly set to Can you confirm if this is the case? If so, can you suggest a way around this? For example, is there a way to have two cells generated for a single dataKey definition? Thanks in advance! |
You are correct in that it gets overridden. The |
@simonbengtsson when I tried that in the first pass, it wasn't matching anything on the the dataKey, and as a result |
@simonbengtsson so when I try that, I get the following: Tried the following for dataKey:
|
@simonbengtsson do you have any other suggestions about how to achieve what I would like? i.e. would like to be able to show, potentially, multiple properties from a nested object, as separate columns in the table. |
@simonbengtsson it would seem that I can get to the information that I want via the Thanks in advance, appreciate your support on this. |
@simonbengtsson okay, this approach works...
with this:
Thoughts? |
That seems sensible. It probably is a bug that cell.raw is not set though. Will look into it. |
@simonbengtsson sounds good to me. Thanks again for all your help! |
Seeing as you are using somewhat more advanced features of the plugin. Could you give me some general feedback on how your experience has been? For example things that worked differently from what you expected, unintuitive parts, things that need further documentation etc. And also if you looked into any other library why you chose this plugin. |
The reason for |
sounds good to me 👍
This is the first library that I chose to look at it, and it came as a recommendation from a colleague. Out of the box, I was very impressed with it's functionality and based on the examples that you provide from the GitHub repository I was able to see that it covered all the main use cases that I had, i.e. controlling look and feel, multiple tables, etc. The more advanced use cases are likely to be an edge case, so not sure how worth it would be to try to document those. If the ability to drill down into nested properties gets OOTB support then that would definitely be something to cover. One general comment about this page: https://simonbengtsson.github.io/jsPDF-AutoTable/ It would be good if I could "see" the code that went into creating what appears on the right hand side of the page. I know that I can jump to the example.js file and drill into it, but it would be easier for someone coming to it to see the required code alongside the example. Just a thought. Overall, very impressed with this plugin, great work! 😄 |
Thanks! And good point about the being able to see the code at the same time as the demo. Will fix that in the next version of the demo page. |
Right now you either have to flatten your data before passing to autotable or use the hooks to parse the exact data. Research a way to for example allow specifying the nested property to be used with a dot notation. See https://stackoverflow.com/questions/44133030/access-nested-json-property-in-jspdf-autotable-plugin
The text was updated successfully, but these errors were encountered: