ccm.app.js throwing uncaught TypeError messages when loaded onto the view page
Permalink 1 user found helpful
Hello,
I am currently working on an addon that require to open a page into a dialog for guest users.
For this reason I use the dialog() js function provided by ccm.app.js
First I had a hard time to figure out why it did not load correctly, before realizing that this shall be loaded in the footer and not header. Here is the correct code in the block controller :
That done, all works fine (I can use the .dialog() function into my code), but I get the following error message thrown into the console upon loading :
I first thought it was due to my code, but actually, even if I don't add my scripts, the simple load of ccm.app.js does fire this (only for guest users though, which makes me think I missed something).
Could somebody point me the (obvious?) mistake I did there ?
(honestly I could just ignore this message, as it does not mess with my features, but ... well ... it’s pretty ugly)
I am currently working on an addon that require to open a page into a dialog for guest users.
For this reason I use the dialog() js function provided by ccm.app.js
First I had a hard time to figure out why it did not load correctly, before realizing that this shall be loaded in the footer and not header. Here is the correct code in the block controller :
public function on_page_view() { $html = Loader::helper('html'); $this->addHeaderItem($html->css('jquery.ui.css')); $this->addHeaderItem($html->css('ccm.dialog.css')); $this->addHeaderItem($html->css("ccm.app.css")); $this->addHeaderItem($html->javascript("jquery.js")); $this->addHeaderItem($html->javascript('jquery.ui.js')); $this->addFooterItem($html->javascript('ccm.app.js')); }
That done, all works fine (I can use the .dialog() function into my code), but I get the following error message thrown into the console upon loading :
Uncaught TypeError: Object [object Object] has no method 'popover' ccm.app.js:9 (anonymous function) ccm.app.js:9 n jquery.js:2 o.fireWith jquery.js:2 e.extend.ready jquery.js:2 c.addEventListener.B jquery.js:2
I first thought it was due to my code, but actually, even if I don't add my scripts, the simple load of ccm.app.js does fire this (only for guest users though, which makes me think I missed something).
Could somebody point me the (obvious?) mistake I did there ?
(honestly I could just ignore this message, as it does not mess with my features, but ... well ... it’s pretty ugly)
Another thing to beware of is that when dom from the page is loaded into a dialog, it is destructive of the original dom. So if loading from the page (rather than by ajax), you may want to clone it first.