Accessing page objects from masterPage.js

Hi all, I’m trying to access a page’s object from the masterPage.js. I detect which page is loaded and I’d like to refresh a table that is in that specific page. Is that at all possible?

let page = wixLocation . path [ 0 ];
if ( page == “mypage” )
$w ( wixLocation . url + “/” + page + “/#myTable” ). refresh ();

After you have detected the right page from MASTER-PAGE…

let page=wixLocation.path[0];

if (page== "mypage") {...do something here...}

you will have to refresh your table like the following…
$w(‘#myTable’).refresh();

let page=wixLocation.path[0];

if (page== "mypage") {$w('#myTable').refresh();}

or the direct way…

if (wixLocation.path[0] == "mypage") {$w('#myTable').refresh();}

… and normaly it should be like…

if (wixLocation.path[0] === "mypage") {$w('#myTable').refresh();}

…but i assume, you will have your reason why you use just 2x equal-signs.

Thank you, it works.:slight_smile:

1 Like