Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
edwin
Master II
Master II

d3 table does not appear in extension

hi, i need to create a table extension with a few bells and whistles.  i wanted to leverage the mouse events in d3 so i looked around how to create tables in d3, i tried the following code using html (just to prototype it) and it works first time.  however, once i add it to an extension, nothing renders.  it seems adding the table to body does nothing in an extension

define(["https://d3js.org/d3.v4.min.js", "./properties",  'text!./style.css'],
function (d3, properties,  cssContent ) {
   	return {
       	initialProperties: {qHyperCubeDef: {qInitialDataFetch: [{qWidth: 1,qHeight: 1000}]}},
		definition: properties,
        paint: function ($element, layout) {
			$( '<style>' ).html(cssContent).appendTo( 'head' );
            var dataMatrix =layout.qHyperCube.qDataPages[0].qMatrix.map( function(d) { return  d[0].qText ; })
			var body = d3.select("body");
			var table = body.append("table");
			var tr = table.selectAll("tr")
				.data(dataMatrix)
				.enter()
				.append("tr");
			var td = tr.selectAll("td")
				.data(function(d) { return d; })
				.enter().append("td");
			return qlik.Promise.resolve();
		}
	};
} );

 does anyone have any idea whats going on?

thanks
edwin

0 Replies