MySQL to uibuilder - Parse array

I've tried all sorts of things and I'm sure the solution is simple, but how do I go about looping through the array I'm getting in uibuilder so I can display a simple table? :slight_smile:

Thank you,
Chris

First you need to choose whether you want to send the whole thing through uibuilder in 1 go and process on the front end. Or whether you want to split it in Node-RED and send each entry separately.

In the example you show, you may as well send the whole output to your front-end.

Then in your index.js file, inside the uibuilder.onChange function, simply assign the array to a Vue data variable. You need to set the data variable up in the data section of the Vue app, assigning it an empty array so that Vue knows what to expect.

Armed with the data, you set up a b-table in your index.html file, assigning the data variable as the data for the table. Each array entry is treated as a row, each property in the row Object is treated as a column.

1 Like

Just to be sure I understand, do I iterate each array in the object or do I assign the entire object to the variable? I'm new to Javascript and Vue.

Thank you,
Chris

The point of using something like Vue or REACT is to let the framework do all the hard bits.

Just have a play and follow the docs, you'll be fine.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.