intel/appframework

Error in loadAjax() when using $.afui.loadContent()

nsundberg opened this issue ยท 13 comments

I am trying to use $.afui.loadContent() to load an external html file, as per the documentation, but getting the following error:
Uncaught TypeError: Cannot read property 'getAttribute' of undefined

The reason is src/af.ui.js:834:
var forceRefresh=anchor.getAttribute("data-refresh");

When using $.afui.loadContent() anchor is never set.

The documentation also states that you can persist panels by using:

//you must set every parameter, with the last being "true" so it knows to perist the div
$.afui.loadAjax("content.html",false,false,"slide",true)

Which of course also results in the same error since anchor is not a DOM object.

I m facing the same issue. It seems that this fix is not merged yet. Are there any suggestions here?
Thanks in advance.

@stegrams - I made the commit against master . You can see it at cac825d Not sure how you are implying it was "not merged in".

@imaffett - As I can see here, anchor fix is not applied in master branch.

To be honest, I m not sure if the "not merged" is the right expression.

So, my understanding here is that anchor parameter in loadContent is mandatory when target is not an HTML id. Isn 't that right?

@stegrams no...the fix was made. That is the master branch. I'm not sure what's confusing you.

@holmberd thanks - I know it's there, I made the commit. I'm not sure what @stegrams is not understanding.

To clear things up, the fix was made and merged against master on commit cac825d and was later reverted back in a more recent commit 698acb4

Cheers.

Do you know @holmberd if that is based on a decision or is about a misplaced commit that will be fixed in a later version?
Thanks

I'll be honest, I haven't looked at this code in over a year. If someone wants to submit a PR to fix this, I'll merge it. Otherwise it will stay in this state.

@stegrams I don't know. I understand @imaffett is busy and my guess is that it was reverted back for a reason.

@holmberd it was most likely reverted by accident (me not pulling down and doing a push). That fix you outlined should be there. If you want to open a PR bringing it back, I will merge it!

@stegrams - this should be resolved once again. Sorry for the confusion.

@holmberd - Thanks for setting me strait on the issue and offering a fix.

@imaffett sorry for not getting it done faster, had some problems with closure, just managed to get the build now to see you already fixed it ๐Ÿ‘