datatree icon indicating copy to clipboard operation
datatree copied to clipboard

Dynamically populate the HTML repr

Open TomNicholas opened this issue 1 year ago • 3 comments

@andersy005, @jbusecke and I noticed that for big trees (hundreds or thousands of nodes) the HTML repr can become very slow to render, potentially locking up your jupyter notebook.

We think that's because the HTML representing the whole tree is pre-rendered in one go, and hidden by defaulting sections to be closed. If your tree contains thousands of nodes that's a lot of HTML to render.

@andersy005 suggested that perhaps the HTML repr should contain some kind of callback, so that the code to render new nodes is only opened

I don't know if that's possible at all, or whether it would work for reprs rendered in non-interactive environments (such as in xarray's static docs pages).

TomNicholas avatar Jan 19 '23 22:01 TomNicholas

Hi there can you assign me to this issue

satyamksharma avatar Mar 19 '23 11:03 satyamksharma

This improvement would be great! I recently created a datatree object with ~150 or so nodes and opening the repr was very clunky.

norlandrhagen avatar Oct 18 '23 17:10 norlandrhagen

I would love for this to happen but really have no idea how to do it (HTML is not my strong suit!) If anyone else has any time, tips, or examples of similar callbacks in other code then that would be very helpful.

TomNicholas avatar Oct 18 '23 19:10 TomNicholas