[FIXED] - Wix code - Table-Dataset-Collection update

Hi all

I have a page with a Dataset, connected to a Collection, and a Table, connected to the Dataset.

I am trying to have the following behavior : when a row in the Table is clicked :

  1. Update data value in the row
  2. Update corresponding row in Collection

My understanding was that there was a 2-way link between Table, Dataset and Collection, meaning I thought an update to a value in the table would automatically trigger an update to the Dataset, which itself would trigger an update to the Collection.

But that does not seem to be the case :

  • Table data is updated
  • But Dataset value do not change, neither does the row in the Collection
  • Event the table.onDataChange handler is not called.

Thanks for you insights.

Here’s code from my page :

// Here I update the Table content
 $w("#table2").onRowSelect( (event, $w) => {
 let rowData = event.rowData;     
 rowData["status"] = "Done";
// Table is updated all right, it shows on the page
 $w("#table2").updateRow (rowIndex, rowData);
} );

 
 // KO, not triggered 
$w("#dataset2").onItemValuesChanged( (itemBeforeChange, updatedItem) => {   
  console.log("OH - dataset2.onItemValuesChanged"); 
} ); 

// KO not triggered
$w("#table2").onDataChange( (event, $w) => {
  console.log ("OH - table2.onDataChange");
});

// OK triggered
$w("#dataset2").onCurrentIndexChanged( (index) => {
  console.log ("OH - dataset2.onCurrentIndexChanged");
} );

Hello Jerome,

Try adding a .refresh() after the click event to refresh the dataset and data received from it.
Heres more on the refresh function.

If this does not work, can you also link your website so that I may view it?

Thanks,
Majd

Hi Majd

Thanks a lot for your feedback.
I’ve tested Repeater instead of Table to bypass the problem, and it seems to be working fine.

Cheers
Jérôme