5

I have created Gui Extension and I use jQuery in command javascript. I have $j selector instead of $. It works in three environment but doesn't work in one (the 4th). I have the following error

ReferenceError: $j is not defined

I didn't explicitly reference jquery in my Gui Extension. This is what I have in my config:

<resources cache="true">
<cfg:filters/>
<cfg:groups>
  <cfg:group name="Archive.ConfigSet" merger="Tridion.Web.UI.Core.Configuration.Resources.CommandGroupProcessor" merge="always">
    <cfg:fileset>
      <cfg:file type="style">{ThemePath}/Archiving.css</cfg:file>
      <cfg:file type="script">/Commands/ArchiveCommand.js</cfg:file>
      <cfg:file type="reference">Archive.Interface</cfg:file>
      <cfg:file type="script">/Users.js</cfg:file>
    </cfg:fileset>
    <cfg:dependencies>
      <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
      <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
    </cfg:dependencies>
  </cfg:group>
  <cfg:group name="Unarchive.ConfigSet" merger="Tridion.Web.UI.Core.Configuration.Resources.CommandGroupProcessor" merge="always">
    <cfg:fileset>
      <cfg:file type="style">{ThemePath}/Archiving.css</cfg:file>
      <cfg:file type="script">/Commands/UnarchiveCommand.js</cfg:file>
      <cfg:file type="reference">Unarchive.Interface</cfg:file>
      <cfg:file type="script">/Users.js</cfg:file>
    </cfg:fileset>
    <cfg:dependencies>
      <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
      <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
    </cfg:dependencies>
  </cfg:group>
</cfg:groups>

I have tried to add jquery.js to this config (based on this article) but I got exception that item with same id is already added.

I cannot find differences between environment. Do you have any idea what could be the problem?

  • When you say it doesn't work, what do you mean exactly? What kind of error do you get? – Peter Kjaer Mar 31 '17 at 13:20
  • 1
    _ReferenceError: $j is not defined_ I tried with '$' and with 'jQuery()' and it didn't work. I could try to add reference for jquery in GUI Extension but than I will not have consistent state in all environment. I already have tried to add reference to Gui extension on other environment but jQuery was already included so it made a conflicts. – aleksandar Mar 31 '17 at 13:31
  • 1
    Is it possible jQuery is not included in the 4th environment? Is there another extension which adds jQuery which is not installed? – Rob Stevenson-Leggett Apr 2 '17 at 11:56
  • Also - please update your question with the error message in your comment. – Rob Stevenson-Leggett Apr 2 '17 at 11:56
  • 1
    I found what was the problem. There was one extension that includes jquery in the first three enviroment. That was the reason why there wasn't jquery available on the 4th enviroment. Thank you for the help. You can move your comment as an answer so I can accept it. – aleksandar Apr 3 '17 at 13:01
4

As I suggested in the comments - it sounds like there is another extension which adds jQuery which was not installed on your 4th environment.

Glad your problem is resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.