5

Hi GUI/Anguilla Experts,

I am trying to call a function once FilteredListControl (shows items in the right panel in tridion GUI) finished loading. I am adding event handler as below but it doesn't work. I've tried "start" and "draw" events as well but no luck.

var FilteredListControl = $display.getView().getFilteredListControl();
$evt.addEventHandler(FilteredListControl, "load", function(){alert('loaded')});

Any idea what's wrong with this?

Update

The problem I am trying to solve is, when a user selects a repository item in left panel and right panel gets refreshed, at that event I want to place a search textbox just above the results, same as this plugin.

4
  • 1
    Are you "waiting" for the $display object to be ready? can you put here what errors you get in the console if any? May 16, 2016 at 13:29
  • Hi Jaime, yeah I am waiting for the $display object to be ready. The code in the question is the part of "onDashboardLoaded" function I am calling in $evt.addEventHandler($display, "start", onDashboardLoaded). Also I am getting the FilteredListControl object, loging it in the console. May 16, 2016 at 13:37
  • 1
    does such object (FilteredListControl) trigger a "load" event? What are you trying to accomplish, by the way. May 16, 2016 at 13:38
  • I am not sure about the events associated with "FilteredListControl", is there a way to find those events, any documentation? Also I've updated my question mentioning the problem I am trying to solve. May 17, 2016 at 8:33

2 Answers 2

2

That's because the FilteredListControl doesn't fire one of those events. You can check which events are fired by attaching a listener to all events. E.g.:

$evt.addEventHandler(FilteredListControl, "*", function(event){console.log(event);});

To achieve what you want you have to attach an event handler to the TreeViewControl like this:

var treeControl = $display.getView().getTreeControl()
$evt.addEventHandler(treeControl, "select", function(event){console.log('selected');});

I'm not entirely sure if this event fires at the correct moment, but for placing a textbox it should suffice

2

So, Using Albert's code as below I figured out that FilteredListControl didn't has any event associated with it.

$evt.addEventHandler(FilteredListControl, "*", function(event){console.log(event);});

Then I extracted the list control from it and that does have the "draw" event associated with it. Attaching a event handler function to this event solve my problem.

Code:

var filteredListControl = $display.getView().getFilteredListControl();

var listControl = filteredListControl.getList();

$evt.addEventHandler(listControl, "draw", myHandlerFunction);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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