renderjson
renderjson copied to clipboard
Feature Request
This is an amazing tool, thank you for building it!
I'd like to be able to update the json structure dynamically and preserve which nodes are open or folded.
Perhaps by having a way to query for the currently 'open' nodes, and to pass that result in when generating the replacement HTML. The query result would have to be somewhat aware of the data content so that nodes not present after the update are ignored. This same mechanism could be used to give people fine grained control over which nodes are opened during the initial display.
+1, would be wonderful to programmatically control what's expanded and what isn't
Yes, I was really looking for a ElementWrapper.expandAll() function.
Here's a wacky method to open the next layer of all of the trees on the page:
document.querySelectorAll('span:not([class]').forEach(function (el) {
var a = (((el.children[0] || {}).children|| [])[0] || {});
(a.click || function(){} ).bind(a)();
})
In english: Get the first child of the first child of the span elements without class attributes, and click them all.
Be careful though, If this matches some similar structure on your page, you might click something you don't want to click.