VolkovLabs / business-text

The Business Text panel plugin allows you to construct a text visualization template from the values of a dataset returned by a data source query.
https://volkovlabs.io
Apache License 2.0
83 stars 13 forks source link

Error set or read properties through DOM #210

Closed jaomuro closed 1 year ago

jaomuro commented 1 year ago

Greetings.

I'm trying to implement the suggested automatic scrolling from the Dynamic Text Panel plugin community article; however, I noticed that JavaScript code is unable to access the DOM.

An error occurs: Cannot read properties of null (reading 'parentElement')

I performed a simple test with HTML and JavaScript to access the div element through JavaScript and change its background color, but it ended up generating the same error.

Content:

<div class="parent">
  <div class="child1">
    <h1>1</h1>
  </div>
  <div class="child2">
    <h1>2</h1>
  </div>
</div>

JavaScript Code:

const parent = document.getElementsByClassName('parent');
parent.style.backgroundColor = "blue";

The same error occurs: Cannot set properties of undefined (setting 'backgroundColor')

akshay996 commented 1 year ago

https://github.com/VolkovLabs/volkovlabs-dynamictext-panel/issues/225

Same as this issue, you can reference the solution I provided here

jaomuro commented 1 year ago

Thanks for help, still not working for me but the error is no longer occurring, the change via DOM has no effect on rendering. Maybe not all functions via dom are applicable, I will continue testing.

flenoir commented 1 year ago

Hi, i have same kind of question. I want to update a DOM element but need to wait that DOM is fully loaded. Don't know how to do this for the moment

mikhail-vl commented 1 year ago

@flenoir The fix in https://github.com/VolkovLabs/volkovlabs-dynamictext-panel/pull/231.

I plan to release a new version after ObservabilityCON.

flenoir commented 1 year ago

OK thanks a lot will try the new release right after then