7

I am building a GUI extension (for Tridion 2013 SP1). The GUI extension has a DataExtender (which adds a column to the component presentations list on a page view). When I examine the logging of the DataExtender, I see that GUI extension is loaded in all kind of views. That is not what I want because this will slow down the performance of Tridion a lot. I want to load the GUI extension only in the PageView, because that is the only place where the output of the DataExtender is used (see the <ext:view> element in the screenshot).

enter image description here

I already have read this solution: Load GUI Extension JS Files for 1 View but this is only for not loading certain files in a view. What I want is that the dataextender + editorextension is not loaded in other views (so the code is not executed every time).

My question: how to prevent dataextender + editorextension (or whole GUI extension) to only load in a certain view?

  • Looks to me like the configuration part you are showing is correct, but the problem is more in the rest of the configuration and what code you use in there. Can you edit your question and shed some more light on what you load in the resources and which of your code is executed everywhere? – Bart Koopman Apr 16 '15 at 8:17
  • Hi Bart, thank you for your response. I don't load anything in my resources. I only have a dataextender and the editorextension. The problem is that the dataextender is loaded everywhere. The gui extension is loaded via the system.config in WebRoot/configuration – Peter van der Lugt Apr 16 '15 at 11:38
4

Data Extenders are cached in memory and called for every request. The overhead is minimal, so I don't think you need to be concerned with that.

Within your data extender, though, you should check if the request is for a list that you want to add your data to -- before you do any other processing. Check the command and other entries in the context object to determine the relevance.

As for the column, your configuration looks correct so I would expect it to only show up in the Page editing screen.

  • Thank you, Peter. Your answer is very clear and useful. In my data extender I have a check for the relevent command. It indeed only shows up in the Page Edit screen. Now I know I have it configured as best as possible, so that's great ;) – Peter van der Lugt Apr 21 '15 at 11:25
  • You're welcome! It does indeed seem like that would also be an area where the scope could be marked in the configuration, but that is not yet the case. – Peter Kjaer Apr 21 '15 at 11:33
1

Please use the itemtype filter in your JS to enable the gui extension when you need it. Something like:

getItemType(Selecteditem) == 'tcm:64'

This will ensure your GUI is enabled only for pages

  • 1
    Thank you for your answer Bart. But in my extension I only use the Data Extender and an Editor Extension (to add columns). I don't use the Anguilla Framework files in my extension. @Peter Kjaer helped me out with this answer: "Data Extenders are cached in memory and called for every request. The overhead is minimal, so I don't think you need to be concerned with that." – Peter van der Lugt Apr 21 '15 at 11:33
1

In Your js you can check the type of view that you have active.

For example, if you are in a page view, you can check the type this way with js:

$display.getView().getTypeName()

Then you can put some validation like that when you are defining your command:

Extensions.MyExtension.Commands.Sample.prototype._isAvailable = function Sample$_isAvailable(selection) {
     if ($display.getView().getTypeName() == "Tridion.Cme.Views.Page") {
            return true;
      }
};
  • 1
    Hi Julian, thank you for your answer. But my GUI extension only has a Data Extender (to extend the data from the xml response) and an Editor extension (for the extra columns). I am not using a command at all. – Peter van der Lugt Apr 21 '15 at 11:30

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.