This topic is locked
[SOLVED]

 Refresh List Page in Dashboard

7/22/2020 8:34:56 AM
PHPRunner General questions
W
wpl author

Hi All,
the manual says:



To refresh the List page manually, add the following code to the List page: JavaScript OnLoad event:
this.on('afterInlineEdit', function( fieldsData ) {

location.reload();

});


This works as expected on a stand-alone list page - but, does anybody know how to refresh a list page accordingly in a dashboard?
TIA

Regards

Sergey Kornilov admin 7/22/2020

Try the following:

if( !pageObj.myAfterInline ) {

this.on('afterInlineEdit', function( fieldsData ) {

pageObj.reload({});

} );

pageObj.myAfterInline = true;

}
W
wpl author 7/22/2020

Sergey,
thanks for answering. Unfortunately, I copied the wrong section from the manual. Here's what should actually be cited:


To refresh the grid on the List page without reloading the page, use the following code in the JavaScript OnLoad event:
Note: the AJAX search, pagination and sorting option should be enabled (Choose pages -> List page settings).
Runner.runnerAJAX(Runner.pages.getUrl(pageObj.tName, pageObj.pageType)+"?a=return",

pageObj.ajaxBaseParams,

function(respObj){

pageObj.pageReloadHn.call(pageObj, respObj)

});


And this does not work when the list page is residing in a dashboard. It just returns thew complete page which results in an error.
Thanks and regards

Sergey Kornilov admin 7/22/2020

Try the updated code, added some checks. It works in the dashboard.

W
wpl author 7/22/2020

Sergey,
sorry for apparently having confused you. There is no inline edit on that page. It's just a normal list page which should be refreshable via ajax.
Thanks and regards

Sergey Kornilov admin 7/22/2020

Then what event or action will trigger the refresh?

W
wpl author 7/23/2020

Sergey,
it will be called by a JavaScript map component we are implementing. After changes in the map (by moving, zooming, fetching data around the current position), it calls a function

"RefreshGrid" on the list page which in turn reloads the grid with the relevant data via the above cited AJAX functionality ("To refresh the grid on the List page without reloading the page").

This works well if both, map and data grid, reside on the list page, but it does not work when map and grid are components of a dashboard. Then the function will return

the whole page instead of the grid data only. And this will break the whole thing.
Regards

Sergey Kornilov admin 7/23/2020
W
wpl author 7/23/2020

Looks promising. I will give it a try,
Thanks

W
wpl author 7/23/2020

Sergey,
this makes a perfect starting point!
Thanks a lot
Regards