Not able to display dmn-js tables in a div container of class "canvas"

Hi,
I am working with angular 4 project. I am using dmn-js modeler to show the rules in front-end. I am not able to populate dmn-js in particular div class=“canvas” container.
THis is how I tried in my application:

this.viewer = new dmn({container: ‘body’});
console.log(this.viewer);
this.viewer.importXML( res[’_body’],function(err){
This change works well if I test with the online dmn.js editor styles but that shoulnt be the case

Will the styles present for the online dmn-js editor will be present in the library? Do I need to write any customized styles for my dmn table to display in my UI.

If you want the viewer/modeler to be displayed in the desired container you have to specify it. You specified { container: 'body' } which is the default option.

You’d have to do this:

var myContainer = document.getElementsByClassName('canvas');

this.viewer = new dmn({ container: myContainer });

This is not working for me. It is throwing me an error “parent.appendChild is not a function”

Are you sure your container element is not undefined?

Yea it is not undefined

How does your HTML look and what code exactly are you executing?

These are my .html and .ts files that I am using in angular 2 components.

Hi Phillip,
@philippfromme I did manage to get that into my required container but the problem is, since it is getting displayed in the container that is present in the bottom of page it not going beyond the scrollable limit. PFA screenshot

the remaining rules are not visible anymore.

Did you attach the screenshots? I can’t see any. :disappointed_relieved:

Hi Phillip,
I got the issue solved I am able to render the dmn tables in the required dmn container now. Thank you