Table/Form Refresh

I built an invoice using the Knack recipe and it works almost flawlessly, however, when I add a line item, the Asset column(s) doesn’t refresh. As you can see the Quantity (3) updates and the extended price ($90.00) updates, but the asset description does not. I must refresh the browser page for Asset columns to display. As a test, I added both the a Text Formula Field, as well as the root field. This isn’t device specific, as I’ve tried on desktop & a tablet with the same result. I really don’t want the answer to be to refresh the browser page every time an item is added. Thank you in advance for your expertise and advice!!

Hi @JarrodSevi20608 - This is one of the issues with having a form that adds a record embedded in the page rather than linking from a menu.

You have a few options.

1 - Refresh the page after each item added, not a great option and not one I’d recommend.
2 - Add the form again and check the box to link it from a menu. Set the form as a modal popup and change the form submit to redirect to parent. This will reload the parent page on submission and pull through the connected values.
3 - Add the below JavaScript so when you submit the form it reloads (fetches) the table.

$(document).on(‘knack-form-submit.view_xxx’, function(event, view, record) {
Knack.views[“view_xxx”].model.fetch();
});

2 Likes

@CarlHolmes Thank You! I opted for #2 for now. I greatly appreciate your advice!

1 Like

How do I find the view number? [“view_xxx”]

@Chris9 - From the Pages section of the builder, navigate to the page and click on the specific form component. The view number will be displayed in the URL address bar in your browser.

YES!!! Thank you @CarlHolmes !!!
I have always used option 2, but wondering how hard it would be to make a JS refresh option! (Still learning)
I am implementing this in one of my apps right now!
If I could press the heart 5 times I would!!!
:+1:

1 Like