robrtc
robrtc

Reputation: 2727

Getting the WebDavURL from Tridion Anguilla in the List View

I would like to get the WebDavURL property of an item int he listview using Anguilla for a GUI Extension.

I have the following code but WebDavURL is not returned:

selectedItem = selection.getItems()[0];
var item = $models.getItem(selectedItem);
var webDavUrl = item.getInfo().webDavUrl();

Upvotes: 4

Views: 316

Answers (1)

Alex Klock
Alex Klock

Reputation: 1526

You'll have to actually load the webDavUrl... item.loadWebDavUrl(). You'll have to set an event handler though to notify once the WebDav URL has been loaded as its an asynchronous method. Here's a sample that includes loading and setting an event handler:

var item = $models.getItem(selectedItem),
    webDavUrl = item.getWebDavUrl();

if (!webDavUrl) {
    // WebDavUrl for cached item hasn't been loaded yet, so lets load it.
    $evt.addEventHandler(item, "loadwebdavurl", function (event) {
        webDavUrl = item.getWebDavUrl(); // also could do event.source.getWebDavUrl()
    });
    item.loadWebDavUrl();
}

Hope that helps!

Upvotes: 8

Related Questions