I have a data collection in wix id name is entriesDB and I have a table on my page that is connected to the entriesDB my table id is table2 I want to update my table data live whenever there are any changes or new entries in my data collection without using setInterval or setTimeout method, I know there is data hook method but I really don’t know how to use that,
what I have to write inside the hook? and how do I have to call it on the front end page?
I have searched on Google chatgbpt but everywhere I got more confused and got wrong answers still, my table2 updates on page load only but not updating my table values whenever there are changes in my data collection entriesDB
I hope Wix Velo experts will help me as I am looking for this from many years but there is something that I am missing.
i don’t have any field specified to update my entire table on every change in data collection.
i am still learning and don’t have much knowledge of coding please give me the simplest solution
I created data hook on afterUpdate (for my data collection lik this in back-end
back-end
export function entriesDB_afterUpdate ( item , context ) {
//TODO: write your code here…
}
front-end
$w . onReady ( function () {
loadTableData ()
});
function loadTableData ( ) {
wixData . query ( ‘entriesDB’ )
. find ()
. then ( res => {
let tableData = res . items ;
$w ( ‘#table1’ ). rows = tableData ;
})
. **catch** ( err => {
console . log ( 'Error:' , err );
});
}
In short, my table id is “table1” on my page, and my data collection id is “entriesDB”
my table1 is connected to the data collection using dataset1, I hope everyone can understand the situation that I am facing.
Because I am not a professional in Java or wix velo, this code is missing so many things but I am not able to write any line of code without knowing the javascript functions or without learning the database please edit my code so that I can understand it easily.