Modal Pop up to show SharePoint List items
-
04-10-2020 - |
Domanda
I have a list called "XYZ" that stores users in it. I have a page with summary links web part that also has a link which would open a modal popup.
This popup should show all the list items of "XYS" list.
I am using the client object model with javascript for the implementation in SharePoint 2010.
Soluzione
SP.UI.ModalDialog.showModalDialog({
url: "URL of List",
title: "Title of page",
allowMaximize: true,
showClose: true,
width: 850,
height: 600,
dialogReturnValueCallback: newCallback
});
function newCallback(dialogResult, returnValue) {
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
Altri suggerimenti
To open a popup in Sharepoint, you can use the function named OpenPopUpPageWithTitle. The syntax looks like this
OpenPopUpPageWithTitle('URL of your list', callback, width, height, 'Custom title');
if your link have an id of 'ABC', you can add a click event to this link using JQuery like this :
$(document).ready(function() {
$('#ABC').on('click',function() {
OpenPopUpPageWithTitle('URL of your page', callback, width, height, 'Custom title');
});
});
If you don't need a callback function leave this parameter to null.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange