J. G.
J. G.

Reputation: 1832

Appmaker Navigate to a dynamic page

i've got a straightforward problem. I'm using a grid to create a large navigation page, based off a lookup table, but this doesn't work for the onclick. Why not?

var p = widget.datasource.item.InputFormPageName;
console.log(p); //LOOKS GOOD
var pagestring = "app.pages."+p;
console.log(pagestring); //LOOKS GOOD
app.showPage(pagestring);

Expected behavior: app opens pages "pagestring" Actual behavior,> throws error:

(TypeError) : Cannot read property '_d' of undefined at EveryFlavor.PagePanel.Grid1.Grid1Cell.onClick:5:5

The simpler

app.showPage(app.pages.p);

Threw the same error as does

   app.showPage(app.pages[p]);

Upvotes: 1

Views: 47

Answers (1)

Morfinismo
Morfinismo

Reputation: 5253

That is because you are trying to compose the path to the object using dot notation. This won't work. Instead, please use the square brackets notation:

var p = widget.datasource.item.InputFormPageName;
app.showPage(app.pages[p]);

Upvotes: 1

Related Questions