How to refresh a view based on the click of an action button

Thanks Sunny. Sorry, I’m a Javascript rookie. Does this appear to be the correct code for the JS side?
$(document).on(‘knack-form-submit.view_621’, function (event, view, data)

Knack.views.view_621.model.fetch();

});

yes.

Shoot, it’s not working. Its causing some kind of error not allowing any of my custom js to run, do you see any syntax errors perhaps? Thanks!!

yes
$(document).on(‘knack-form-submit.view_621’, function (event, view, data)
{
Knack.views.view_621.model.fetch();

});

Thanks Sunny! The code has no errors now, but still does not make the table refresh after the form is submitted above it, in the same View…

$(document).on(‘knack-form-submit.view_621’, function (event, view, data)
{
setTimeout(function(){Knack.views.view_621.model.fetch();},1000);

});

if still having an issue change 1000 to 2000
then check

or check your views

Thanks so much, now it works!!

Hi, is it possible to refresh a view details ? (I have no issue to refresh a view table (records) ).

When I execute the JS (Knack.views.view_XXX.model.fetch()) on a view details, I can see that the browser makes a network request and gets a response with the view details data, but the view details is not updated ?

thank you

Hello Simon,

Already explain above. Please check the message trail.

Regards,
Sunny Singla

Hi Sunny,
My action link is in the table itself appearing for each record and it triggers a mail on click(not opening any view but i have set outome message “successfully submitted”). I placed your following code in the app javascript section, but it is not updating the table. Sure I am doing some mistake, any idea where I am wrong please?

$(“#view_1961 .kn-detail-body”).live(“click”,function(){

setTimeout(function(){

Knack.views[“view_1961”].model.fetch()

},30000);

});

Thanks and Regards
Asokan

Hello Ashokan,

Look like there is no issue. Maybe you didn’t wait 30 sec to update as you added 30-sec interval.

Or I think you added wrong class for action link class is “kn-action-link”

Regards,
Sunny Singla

Thank you so much Sunny!

Now it works with the below code!

$(“#view_1961 .kn-action-link”).live(“click”,function(){

setTimeout(function(){

Knack.views[“view_1961”].model.fetch();

},30000);

});

1 Like