Closed Evgeny243 closed 11 months ago
If you are using one of the latest versions of Data Manipulation 3.1.0+, then use this code to update local state:
onChange(elements.map((element) => {
return element.id === 'name' ? { ...element, value: 'test' } : element
});
What it does it's going thru all elements (map
functions) and looking for the element with id equal to name
. If found updates its value to test
.
@Evgeny243 please let us know if the solution above works for you
In my project upon press of the Update button the contents of first element (String-Input, ID=NameIn) are written into influxdb, and on the next Initial Request they are read out from influxdb into another element (Read-only, ID= NameOut). I want at the pressing of Update button not only the contents written to the influxdb, but also clear them from the String-Input element, so that they are not displayed twice in two elements, but only displayed in the Read-Only element. I found the following code on your website, but I do not understand how it works, and so can not modify for my specific case. I'd appreciate your help, thank you!
onOptionsChange({ ...options, elements: options.elements.map((element) => { return element.id === "name" ? { ...element, value: "test" } : element; }), });