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

I am attempting to use LaunchPickerTreeDialog js method to launch the OOTB SharePoint list picker. It works fine when selecting a list within the current web application however if I pass a parameter for a separate web application the picker shows and allows me select a list but closing it does not fire my call back function. Does anyone know why?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Hard to tell without code, but I'll try to post you solution that works for me.

You have to add this code to aspx page where you'll use tree dialog (in my case it's copy.aspx):

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<SharePoint:ScriptLink ID="ScriptLink1" language="javascript" name="PickerTreeDialog.js" runat="server" />

Then add JS function definition:

function launchPicker() {
var host = location.protocol + "//" + location.hostname;
var url= "<%= SPContext.Current.Web.Site.Url %>";
var callback=function(arr)  {
    if(arr==null || arr==undefined)
        return;

    var x=document.getElementById("<%= TxtFolder.ClientID %>");
    x.value = host + arr[3];
}
LaunchPickerTreeDialog("RouterPickerSelectListTitle","RouterPickerSelectListText","websListsFolders","",url,"","","","/_layouts/images/Copy.gif", 0, callback, '', '' );

}

And then final code to use picker and control to store value in:

<table width="100%">
<tr>
    <td width="100%">
        <wssawc:InputFormTextBox title="<%$Resources:wss,copy_enterfolder%>" class="ms-input" ID="TxtFolder" Columns="35" Runat="server" maxlength=255 size=60 width=100% />
    </td><td>
        &nbsp;<input type="button" id="sendToBrowse" onclick="launchPicker();" value="..." />
    </td>
</tr>

This is not entirely my solution. I've found it weeks ago somewhere on internet and modified to meet my needs.

Hope it helps.

share|improve this answer
add comment

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.