Back to forum

Cab able to apply webdatarocks to dynamically created element?

Answered

Please advise us how to apply webdatarocks to dynamically created element instead of DOM element using jQuery application.
I’m getting below mentioned error
WebDataRocks Reporting Component:
Unable to create the component. DOM element with id ‘#report_0’ is not found.
Note: ‘#report_0’ element created on run time.

1 answer

WebDataRocks Team WebDataRocks April 3, 2020

Hello, Ezhumalai,
 
Thank you for your question.
 
In case the container for the pivot has to be created during the runtime, the instance itself should be created dynamically as well.
 
Until the moment the instance of WebDataRocks is created, the container it is going to be placed in should exist.
 
Therefore, it is possible to create an instance of the component right after the container is dynamically created in order to achieve the desired result.
 
For example, the following code snippet can be considered as a template:

function creator() {
$("#wrapper").add("div").prop("id", "wdr-component");
var pivot = new WebDataRocks({
container: "#wdr-component",
...
});
}

The “creator” function is responsible for the creation of an appropriate HTML element (container for the component) and creation of the instance itself right after the creation of its container is finished.
 
Please see an example demonstrating such an approach we have prepared for you.
 
We hope it works.
Please contact us in case of additional questions.
 
Kind regards,
WebDataRocks Team

Move up