Rendering a Dataview table in an HTML element

I’ve been trying to render a dataview table in one of my HTML based sidebar things and I am having trouble figuring out a good way to do it, I’ve tried various methods and the closest I’ve got is the following snippet

dv.container = document.getElementById("dataview");
dv.execute("TABLE TimeComplexity FROM #Non_Mutating_Algorithms");

It however appears very janky often times duplicating itself, not rendering, lagging randomly, etc. The main issue however is that it wont even render when I am in reading mode

This is how it looks in Edit mode

This is how it looks in Reading mode