Is there a way for javascript to automatically detect when an embedded table has had rows updated?
Is there a way for javascript to automatically detect when an embedded table has had rows updated?
I have embedded a cloudtable on my site. On one page the user manually enters/changes/deletes data. On two other pages the javascript uses the data. If I update the data on the editing page, the changes are automatically pushed to show up in the table viewed on the other two pages. When a page is pushed an update is there any way that javascript on the page could automatically be notified that the update has taken place? My page which uses the data is here: https://philipmarksart.com/gallery. My page on which data is entered is here: https://philipmarksart.com/pjonly. I have looked at the events in the reference and there does not seem to be an event for such a detection. thanks
This question has an accepted answers - jump to answer
Answers
Hi,
Thanks for your question - its a good one! I just want to check my understanding fully first (as a cravat to my second paragraph here!) - your gallery page doesn't embed a CloudTable, rather it is generated from the API. And you want it to get a notification when the data has changed so it can update?
At the moment no, that isn't possible with CloudTables I'm afraid. Even a page with a CloudTable doesn't actually emit an external notification when someone has updated the data (although I think that's a good idea and will look at that). If that were working, then I suppose you could have embedded the CloudTable hidden, and received the notifications that way, but there isn't a way to have just notifications of new / updated data without a CloudTable. I like that as an option though, and I've added that to my features list.
Regards,
Allan
Thanks for the quick response. Sorry to hear this is not possible. Since I can't be notified automatically when the cloudtable updates, i'll just check the table periodically and determine if the total number of records has changed. For instance, on my "gallery" page, if the total number of records has changed then I'll refresh() the page to reflect which imgs have been added or deleted. Shouldn't be a problem. fyi three of my pages do embed a cloudtable by putting the "data-ct-insert" html inside a code block. When my pages refresh javascript does read from the cloudtables. On my "gallery" page, upon refresh, my javascript takes some image data from the table and puts it in img elements in another code block. At some point I will hide the codeblock with the cloudtable in it so that the images are the only thing that show on that "gallery" page. similar for the other two pages. Thanks for your help.