Hi all, I was wondering if anyone knows the javascript command to refresh a table or view after an inline edit (or submission of a modal popup form, for that matter). I don't want to use 'location.reload();' as I'd rather not have to reload the full web page.
Currently, when an inline edit is made conditional formatting, data source rules, grouped headers, etc. will not automatically update. I've gotten around this by having a filter button at the top of the table which is a random field set to 'view any' and I have named it refresh table. When you click it - it has the effect of refreshing the table without needing to reload the entire web page. I was wondering if there was a command to do the same thing so I could get rid of the button / extra step.
Basically:
$(document).on('knack-cell-update.view_X', function(event, view, record) { // required code to lightly refresh the table instert code here to refresh view / table:: });
So I finally have a working solution to refresh the current scene upon an action in your live app. It's a really clean refresh, as it doesn't refresh the whole webpage, put just that particular scene. By refreshing the scene, the Page Rules are applied again upon the refresh, so any record updates etc. will be reflected in any page rules you have set. Discovered this great bit of code on this post here: https://support.knack.com/hc/en-us/community/posts/360050441592-Reload-or-Refresh?page=1#community_comment_360013730312
Snippet of how i've applied it to my Javascript section:
Tony's worked well in terms of refreshing every view on that scene, however i need to refresh the whole scene. That way all of the Page Rules etc. that are set up for that scene will be triggered again following the form submission and a slight delay that i add.
So as things stand I'm still looking for the solution that will refresh the current scene (or a scene you can specify in the code) on Form Submission.
Thanks for sharing that code. Would you happen to know how to refresh the current scene upon form submission?
At the moment i have a location.reload set up, however, i'd much rather just refresh the scene rather than the whole page. It's causing some login issues as it's an app embedded within an app essentially.
alert("Please wait while we fetch the Invoice from Autoline. Click 'OK' & this page will refresh shortly...");
Knack.showSpinner();
});
Any ideas how i can amend this to reload the scene only? Wasn't sure if something like this could work for a scene... Knack.scene[scene_2].model.fetch();
If you do put in multiple 'knack-cell-update.view_1 knack-cell-update.view_2', statements they all fire the same Knack.views[view.key].model.fetch(); statement. And if you try to stack the statements it won't work so I had to separate each table update into its own code section.
I'm using the code on the bottom and it works perfectly.
However, I have many tables that I would like to insert in the code. Right now, Im duplicating the code line, but was wondering if there is a way to add to the code multiple views and how can I do that.
That is most likely caused by an overall error on the page. The example posted above was missing the semi-colon at the end. That could be your problem.