appframework icon indicating copy to clipboard operation
appframework copied to clipboard

$.afui.loadContent issue

Open mrwrighty opened this issue 8 years ago • 4 comments

When trying to load a new page I get the following error:-

Uncaught TypeError: Cannot read property 'loadContent' of undefined (Anonymous Function)

My code is:-

$.afui.loadContent("uib_page_1",false,false,"slide");

Also get error:-

Uncaught TypeError: Cannot read property 'getAttribute' of null appframework.ui.min.js:46 g.load Ajax appframework.ui.min.js:46 g.loadContent appframework.ui.min.js:41 (anonymous function) app.js:98

mrwrighty avatar Jun 29 '16 20:06 mrwrighty

I have a similar problem, loadContent does not seem to work properly: $.afui.loadContent('#item'); af.ui.js:983 Uncaught TypeError: from.end(...).run is not a function(…)

the seems to come from line 983-> }).run(transition+"-out");

icrisu avatar Jul 25 '16 16:07 icrisu

I found the solution / workaround for this one, it seems that if you don't pass an anchor param to the loadContent method on line 667 it tries to create an anchor

anchor = anchor || document.createElement("a"); //Hack to allow passing in no anchor

however it fails, so what you need to do is pass the ID of an existing anchor from the dom, or create one than.

Basically you need to do something like:

AppetitMobileApp.prototype.openItem = function(itemID) { $.afui.loadContent("#item", false, false, 'up-reveal', '#test'); };

The last param "#test" is the ID of the anchor.

Cheers!

icrisu avatar Jul 25 '16 16:07 icrisu

@icrisu I have the same problem! but when I pass the ID of an existing anchor and test it , loadContent does not seem to work properly: TypeError: anchor.getAttribute is not a function
var forceRefresh=anchor.getAttribute("data-refresh"); do you have this problem ?

GitCod-Man avatar Aug 24 '16 00:08 GitCod-Man

@GitCod-Man the above has worked for me, sorry I did not have your problem. As I recall I have dynamically created a div with an generated ID, and it worked.

icrisu avatar Aug 29 '16 08:08 icrisu