How does Refresh work on List View?

Capture

I want to know how exactly this Refresh button works on click ?

If not any help, can anyone suggest me where is this file located. I searched in erpnext and frappe for list.js file but didn’t find it.

Check this

Is there any way , i can call (use) this refresh functionality in my custom script (ot cur_frm.refresh or location.reload)

Try this:

For form:

cur_frm.reload_doc()

For List:

cur_list.refresh()

Edit:
I don’t think custom script will work on List View.

1 Like

cur_frm.reload_doc() isn’t working.

What I am trying to do so on opening a form, New Form 1 opens,let say we went to any other doctype and then again reopen the first doctype, it says New Form 2 . I am trying to figure it out that on second time also New Form 1 opens. Any suggestions ?

What are you trying to achieve?
You want to have show New Form 1 instead of New Form 2 when reopen doctype?

correct

What if you force a browser reload (typically F5), like this:

location.reload(); 

This should clear the browser cache, which leads to subsequent numbers…

but using that makes the form reload infinite times.

Ok, what about this (more a hack than a solution, but it should work :wink: )

frappe.ui.form.on("FORM", {
    refresh: function(frm) {
        if ((frm.doc.__islocal) && (frm.doc.name.includes("1")) {
            location.reload(); 
        }
    }
});

this is giving error “Error In Custom Script”

Try this: (missing end braket, and also inverse logic)

frappe.ui.form.on("Employee", {
    refresh: function(frm) {
        if ((frm.doc.__islocal) && (!frm.doc.name.includes("1"))) {
            location.reload(); 
        }
    }
});

yup it is working but cant it be possible by the way how refresh works on list view because it is taking too much time while loading on this trigger to load

Hi ,
Custom script for list not working is there any another way for the list?
please help

Thanks & Regards
Satish