1

Working with SharePoint Online/365, I want to open a SharePoint list from another list on field click. I can get the list in a dialog with the following:

function openDialog(myProject) {  
  SP.UI.ModalDialog.showModalDialog({  
    url: "https://mysite.sharepoint.com/sites/develop_apps/Lists/ProjectCommunications/AllItems.aspx",
    width: 1000,
    title: "Project Communications"  
  });  
}

But how can I open that list filtered? I've tried:

url: "https://mysite.sharepoint.com/sites/develop_apps/Lists/ProjectCommunications/AllItems.aspx#FilterField1%3DProject-FilterValue1%3D" + myProject

url: "https://mysite.sharepoint.com/sites/develop_apps/Lists/ProjectCommunications/AllItems.aspx?View={1}&FilterField1={ProjectId}&FilterValue1={1}"

url: "https://mysite.sharepoint.com/sites/develop_apps/Lists/ProjectCommunications/AllItems.aspx?ProjectId=1"

The first one gives me the entire list (no filtering), the second one gives me "Unable to display this webpart", and the third one gives me the entire list again.

Is there a way to open the list in a dialog with filtering applied?

  • Whay are you using # in first option? You need ? – Juan Pablo Pussacq Laborde Oct 27 '16 at 20:13
  • Same result with /AllItems.aspx?FilterField1%3DProject-FilterValue1%3D" + myProject - all items are shown; no filtering – Michael Oct 28 '16 at 16:44
1

To can show a list with filter in modal dialog you should use Query string (URL) filter web part as the following :

  • Open your list page > Add Query string (URL) filter , configure it with your parameter ProjectId

  • Configure the connection between Query string (URL) filter and your list.

  • In your modal dialog set URL as the following :

    url:"https://mysite.sharepoint.com/sites/develop_apps/Lists/ProjectCommunications/AllItems.aspx?ProjectId=1"

[OutPut]

enter image description here

Also, check my article with detail steps at Open a Filtered List URL in a Modal Dialog in SharePoint

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.