Take the 2-minute tour ×
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

I would like to be able to only load a JavaScript file when the current view is a ComponentView.

So something in the lines of:

<cfg:group name ="groupname" applyTo="ComponentView">
  <cfg:fileset>
    <cfg:file type="script">/javascriptfile.js</cfg:file>
  </cfg:fileset>
</cfg:group>

Is there something available like this?

I know that you can do this within JavaScript ($display.getView()getId() === "ComponentView") but then the file is already loaded.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You need to extend associated View group. In case of ComponentView it is Tridion.Web.UI.Editors.CME.Views.Component

See how to make groupextensions from Eric answer in similar post:

Component Fields available in GUI Extension with fieldBuilder

share|improve this answer
    
Thanks! I had already looked into extensiongroups but I didn't add the resourceextensions. It is working now. –  Thomas Hendrickx Aug 1 at 10:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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