Populate table from Database

Hi, i have a page element table ‘#table1’ and a data base collection ‘#database1
and a dataset ‘dataset1’.
how can i connect ‘#table1’ to ‘#dataset1’ in order to populate the table using code only and not the green link button ?

1 Like

See Example: Wix Data - Multiple-References for displaying query results in a table.

Also, you might want to consider using a Repeater instead as it provides much more flexibility and better layout options. See the Search a Database example to see how to display query data in a Repeater.

thanks Israel, but is there a way to set a table data (in this example the async function loadItemsCollection() ) to populate through a dataset element that was added to the page and not by calling each headline by his name
one by one on the return function
in the end i have many tables and many datasets and only one table
i will need the code to link between that one table to the dataset that is connected to a specific database.
so need the same function that the green "connect to data’=>‘connect to dataset’ button is doing

async function loadItemsCollection() {
let res = await wixData.query(‘Items’)
.include(‘colors’)
.find();
$w(‘#itemsTextBox’).value = JSON.stringify(res.items, undefined, ’ ‘);
$w(’#itemsTable’).rows = res.items.map(item => {
return {
picture: item.picture,
title: item.title,
colors: item.colors.map(_ => _.title).join(', ')
}
});
}

You can initialize a Table by setting the .rows property to the result of the database query.

Similar to @diors question, I have a dataset on a page where I want the user to select their values via a drop down, then the dataset is filtered and displays only the data which corresponds to the user’s input. You can see it here: https://aircooledevolution.wixsite.com/classic/chevrolet-1946-1952

How can I set up a chart which does not show value until the user selects a code from the drop down? For example, when they select the code for the first box, the Model Year which corresponds to this code appears. I am open to re-orienting the direction of the chart if required.

Please open a new post with your own problem, bumping other people’s posts with your problem is against the Community Guidelines .

Thank you for bringing this to my attention. I will open a new post for my question.