Business Cases:
§ Simple Case. (If you want to open SharePoint
dialog and don't care about width, height ...).
§ Complex Case. (To control dialog properties
such as title, width, callback functions ….).
§ Notification. (To notify user about any
information).
§ Loading Wait Screen. (Working on it dialog).
§ Open Modal Dialog in custom action (ECB Menu).
Business Cases Details:
Case One (Simple
Case)
By using
SP.UI.ModalDialog.OpenPopUpPage(url, callback, width, height); javascript function.
url : The URL of the page to be shown in the modal dialog.
callback : function pointer to callback function that runs when the modal dialog is closed.
width : The width of the modal dialog.
height : The height of the modal dialog.
url : The URL of the page to be shown in the modal dialog.
callback : function pointer to callback function that runs when the modal dialog is closed.
width : The width of the modal dialog.
height : The height of the modal dialog.
Demo:
1- Edit page and embed code in it
2- Put this markup in the page source
This method is very simple but it has many
disadvantages:
1- fixed title.
Case One (Complex
Case)
By using Modal
Dialogs.
Modal Dialogs are one of the new features
provided by SharePoint 2010. It's the dialog framework provided by the
JavaScript client object model. Modal Dialogs can fetch data from anywhere and
display it over the page. One good feature about the Modal Dialogs is, there
won't be any navigation to another page, making the user to stay in the context
of the current page. The number of post backs will also be reduced by using
modal dialogs. These dialogs are used in a large scale in many of the
operations, like creating a page, viewing/editing item properties etc.
These dialogs are JavaScript pop up dialogs
with an iFrame in which the data is displayed.
'SP.UI' namespace from the client object
model provides a static class 'SP.UI.ModalDialog' with many methods which are
used for creating dialogs and controlling their behavior.
Demo
1- Create Content Editor
Web Part.
2- Edit source and write
this script
<script
type="text/javascript">
//User
Defined Function to Open Dialog Framework
function
OpenDialog(strPageURL)
{
var dialogOptions =
SP.UI.$create_DialogOptions();
dialogOptions.url = strPageURL;// URL of
the Page
dialogOptions.title = 'Welcome to
SharePoint'
dialogOptions.allowMaximize= true
dialogOptions.width = 750; // Width of the
Dialog
dialogOptions.height = 500; // Height of
the Dialog
dialogOptions.dialogReturnValueCallback =
Function.createDelegate( null, CloseCallback); // Function to capture dialog
closed event
SP.UI.ModalDialog.showModalDialog(dialogOptions); // Open the Dialog
return false;
}
//
Dialog close event capture function
function
CloseCallback(strReturnValue, target)
{
if (strReturnValue === SP.UI.DialogResult.OK)
// Perform action on Ok.
{
alert("User clicked Ok!");
}
if (strReturnValue ===
SP.UI.DialogResult.cancel) // Perform action on Cancel.
{
alert( "User clicked Cancel!");
}
}
</script>
<a
onclick="OpenDialog('http://bing.com');">open dialog</a>
|
Different Properties
There are various properties the showModalDialog()
method accepts through the options object. Below is the list of these
properties
Property Name
|
Type
|
Description
|
allowMaximize
|
boolean (true/false)
|
Determines the visibility of the maximize button (at top right
corner) for the modal dialog
|
Args
|
Object
|
The args property allows us to pass arbitrary properties into
our dialog.
|
autoSize
|
boolean (true/false)
|
|
dialogReturnValueCallback
|
Function
|
This property accepts a callback function which gets executed
when the dialog is closed.
|
Height
|
Numeric
|
The height of the dialog
|
Html
|
HTML Element
|
The HTML to be rendered in the window (when the URL property
is not specified)
|
showClose
|
boolean (true/false)
|
Determines the visibility of the close button (at top right
corner) for the modal dialog
|
showMaximized
|
boolean (true/false)
|
If set to true, the dialog will render maximized, ie., it
fills the available screen space.
|
Title
|
string
|
Title of the modal dialog. When no title is specified, the
title of the document referred to by the Url property is used instead.
|
url
|
string
|
The URL of the page to be shown in the dialog.
|
Width
|
numeric
|
The width of the dialog to be displayed
|
X
|
numeric
|
Specifies the starting position from the left, where the
dialog is to be rendered
|
Y
|
numeric
|
Specifies the starting position from the bottom, where the
dialog is to be rendered
|
Another Demo:
<script
type="text/javascript">
function
ShowWelcomeDialog()
{
var htmlP =
document.createElement('p');
var htmlMsg =
document.createTextNode('Our SharePoint blog');
htmlP.appendChild(htmlMsg);
var options ={
html: htmlP,
title:'Welcome to
SharePoint Developers Hub',
width:400,
height:75,
dialogReturnValueCallback:
ShowStatus
};
SP.UI.ModalDialog.showModalDialog(options);
}
function
ShowStatus(dialogResult, retValue)
{
SP.UI.Notify.addNotification("The
dialog is closed");
}
</script>
<a
title="Open Dialog"
href="javascript:ShowWelcomeDialog();">Open Dialog</a>
|
Case Three (Notification)
Demo
<script>
function Notify()
{
SP.UI.Notify.addNotification("Every
thing is ok.");
}
</script>
<a
href="javascript:Notify();">Notify me</a>
|
Case Four (Loading
Wait Screen)
SP.UI.ModalDialog.showWaitScreenWithNoClose(title,
message, height, width);
Demo
SP.UI.ModalDialog.showWaitScreenWithNoClose(SP.Res.dialogLoading15);
orSP.UI.ModalDialog.showWaitScreenWithNoClose('Loading
Title', 'Loading Message Here...'); |
Case Five (Open Modal Dialog in ECB Menu)
t if you want to open
dialog from ECB menu? Create new custom action in Element.xml file and in UrlAction tag use the
following javascript function.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="{B0B5A0CB-7FBE-4dd6-9B2A-2B1E1321B8F9}"
RegistrationType="List"
RegistrationId="101"
Location="EditControlBlock"
Title="Goto My Blog">
<UrlAction Url="javascript: function
onClose(){ }
var o = {
url: 'http://www.google.com ',
title: 'MyBlog',
allowMaximize: true,
showClose: true,
width: 700,
height: 500,
dialogReturnValueCallback: onClose
};
SP.UI.ModalDialog.showModalDialog(o);"/>
</CustomAction>
</Elements>
|



319 comments
«Oldest ‹Older 201 – 319 of 319 Newer› Newest»I appreciate the depth you went into here. It adds a lot of value to the ongoing conversation about this topic. I am currently exploring the next phase of this trend on my site https://mbwind.com
ReplyBrilliant breakdown. You have highlighted points that many others overlook. I strive to bring this level of detail to the articles on my website as well. It would be an honor to have you visit https://manywaysastrology.com
ReplyThis article serves as a great benchmark for quality content in our niche. I have recently written a piece that functions as a follow up to this topic on my website, would love to know if you agree with my conclusions https://makeukipgreatagain.com
ReplyYour analysis cuts through the noise perfectly. Its refreshing to read content that avoids jargon and goes straight to the point. I apply a similar clear cut philosophy on my website https://marteloderubinero.com . I had love for you to take a look
ReplyThe way you connected these concepts is brilliant. I hadn't considered that angle before. I explore the practical side of these theories on my site, and I invite you to see if it aligns with your views https://mrbones2.co.za
ReplyYou have successfully highlighted the nuances that most people miss. Thank you for this deep dive. I am currently writing about the long term impact of this on my website, and I would value your thoughts https://companionschoice.co.uk
ReplyYou have a knack for foreseeing industry trends. This article is very forward thinking. I am preparing my own audience for these shifts on my website, feel free to visit to see my approach https://cleanerstodaydirect.co.uk
ReplyIncredible article. Your insights are truly eye opening. I would love for you to check out my website at https://hbmodules.co.uk for more content like this.
ReplyThis is one of the best pieces I have read in a long time, brilliant work! Please visit https://uhuruprinters.co.za when you have a moment, i think you will enjoy it.
ReplyAmazing content, thank you for sharing your expertise! Drop by https://forexbrokers-sa.co.za , i have similar topics that might interest you.
ReplySuch a well written and thoughtful article, kudos to you. Feel free to swing by https://midohionews.com for more great reads.
ReplyThis post is pure gold. Your writing is exceptional. Check out https://dialelectrical.co.uk , i believe you will find it valuable.
ReplyLoved every word of this article. You are a talented creator. I would love your feedback on my site at https://isleofmullweavers.co.uk
ReplyWow, this is super helpful. I have been looking for a clear explanation like this. I actually just posted about my experience with this on my website, come check it out https://legitdriverslicense.com
ReplyLove this, your energy really comes through in your writing. I am trying to build a similar vibe on my website, hope you can stop by https://mbscthrive-dcfitness.com
ReplySuch a great read to start my day. Thanks for the inspiration. If you are ever looking for more ideas, my website has a ton of related content https://real-estate-investing-for-beginners.com
ReplyTotally agree with you. Its so important to talk about this. I have dedicated a whole section of my website to this topic if you want to explore more https://shop-nfl.org
ReplySo glad I stumbled upon this post. Keep up the amazing work. I would love for you to visit my site and let me know what you think of my recent updates https://spiedkiks.com
ReplyThis content is really informative and well written. I enjoyed reading it. I also write related articles on my website if you are interested https://schaefer-baustoffe.com
ReplyExcellent post. I learned something new today. If you like this topic, you might enjoy the content on my website too https://gratefulbags.com
ReplyVery insightful article. Thank you for sharing your knowledge. I also write about similar subjects on my website https://noproblemz.com
ReplyThis is a high quality piece of content. Simple, clear, and informative. Feel free to visit my website for related articles https://digipatrika.com
ReplyI really appreciate the depth and clarity of the content provided on this site. https://artisantilenw.org
ReplyThis site consistently delivers content that is both educational and enjoyable to read. https://friendsofhaikustairs.org
ReplyI really enjoy how each article is structured to provide maximum understanding. https://damaulifm.org
ReplyEverything flows logically, follow-up discussion appears on https://isa-corp.com
ReplyEvery article I read here feels thoroughly researched and well-presented. https://nobrazil.com
ReplyThe website offers content that is both practical and intellectually stimulating. https://nobrazil.com
ReplyThe articles are written in a professional yet approachable style that is very inviting. https://bizandroid.org
ReplyI appreciate how the content is organized, making it easy to explore different topics. https://yish.dev
ReplyThe concepts are presented in a relatable way, more examples are on https://whatismagnesiumoil.com
ReplyI love how the articles are structured to deliver maximum understanding and clarity. https://thenewforestcenter.com
ReplyThe writers clearly put a lot of effort into making the content informative and enjoyable. https://m3agecny.com
ReplyReadable and informative at the same time, expanded discussion is on https://wpfpak.org
ReplyThe website consistently delivers content that is educational and well-written. https://leonardowood.com
ReplyI appreciate how the website provides content that is both informative and thought-provoking. https://teplostudio.com
ReplyI am impressed by the effort taken to ensure accuracy and clarity in every post. https://katzen-apotheke.org
ReplyNice pacing that keeps it easy to follow, follow-up details on https://powervoxplus.com
ReplyI find the content very well-researched, making it trustworthy and informative. https://paranoiamachinery.com
ReplyComfortable to read while learning, more examples are posted on https://palmbeachastro.org
ReplyI appreciate the effort put into ensuring the content is detailed yet understandable. https://hedefweb.com
ReplyThe platform provides information that is useful, practical, and well-explained. https://lieuphaptunhien.com
ReplyReally straightforward explanation, added examples are on https://aleupha.com
ReplySome sections really make sense, continuation is written on https://nhatop1.com
ReplyHelps understand key points quickly, added perspective lives on https://azlhofuf.com
ReplyHelps make sense of complex ideas, further explanation is on https://au-bellybalance.com
ReplyVery understandable approach, follow-up discussion is on https://ketotq.com
ReplyWell done. The structure and explanation are top notch. I share similar content on my website if you had like to explore more https://eastbourneadvisoryservices.co.uk
ReplyExcellent content. I love how detailed and helpful this article is. If you are interested in similar insights, you are welcome to visit my website https://christopher-hastings.com
ReplyAbsolutely brilliant breakdown. You make complex topics feel so easy to understand. Love it! More content like this on my website if you are interested https://blackdogrunsdisney.com
ReplyExcellent explanation and great flow. I truly enjoyed this article. I write about similar topics on my website, feel free to drop by https://amincharkh.com
ReplyThis content is pure gold. Clear, concise, and super valuable. Great job. Feel free to check my site for related deep dives https://naivesl.com
ReplyHands down the most helpful article. I have watched this week. You are incredibly talented. I also collect useful resources here https://networthcoaching.com
ReplyYour passion for this subject really shines through. Fantastic work. If you enjoy this kind of content, my website has more https://biketoledo.net
ReplyExtremely well done. One of the clearest and most professional pieces i have come across. More like this on https://orangechamber.org
ReplyYou have such a gift for teaching. This was genuinely enlightening. I curate similar helpful content here https://infoprona.com
ReplyPhenomenal job. Your attention to detail is impressive. Loved every second of it. Check out my website for more https://seedash.org
ReplyThis is the kind of content the internet needs more of. Excellent work. I also share in depth guides here https://denebstudios.com
ReplySo much value packed into one piece, thank you. You are killing it. More awesome resources on my site https://doithes.com
ReplyMasterfully explained. You really know your stuff. If you liked this, you might enjoy my collection too https://khessels.com
ReplyThis is the kind of content the internet needs more of. Excellent work. I also share in depth guides here https://lshplastic.com
ReplyYou just became my go to source for this topic. Fantastic work. I have more curated content here https://kansascitychiefsprostore.com
ReplyOne of the best pieces i have read in a long time, bravo. Related deep content on my site https://themewpvn.com
ReplyExtremely useful and beautifully made, thank you. Check out my website for more insights https://glocodocument.com
ReplyHelpful without overloading, more content is shared on https://uxdish.com
ReplyThis is such an amazing article. You really know how to explain things clearly. More people need to see this kind of quality content. By the way, I also share similar tips on my https://2game.org
ReplyThis content is pure gold. Thank you for sharing your knowledge. If you are interested, i also publish similar helpful guides https://ilovepamplemousse.com/>
ReplyI enjoy reading this site because the content feels reliable and well written. https://fasthubbd.com
ReplyI thoroughly enjoyed reading this. Your writing style is captivating. Please swing by https://cobbshops.com I think youk will like what you find.
ReplyThe modern design gives the site a fresh and dynamic feel. http://simonfactoryoutlet.com
ReplyThe writing style feels approachable and sincere, much like posts shared on https://krongcamboja.com
ReplySome points here made me rethink details I usually ignore; explored further insight via https://thesesmedia.com
ReplyThe article explains things in a way that feels practical and grounded; comparable resources are on https://xpestudio.com
ReplyA genuinely smooth read that naturally encouraged me to continue learning at https://arxra.org
ReplyA refreshing and insightful read that I truly enjoyed. https://princewebdev.com
ReplyI really like how modern and stylish this website looks while still being very easy to use. https://fillerstorefront.com
ReplyI enjoyed the perspective shared in this post. Additional information can be explored at https://oneup-webdesign.co.uk
ReplyThe content is informative, clear, and engaging from start to finish. https://rehber-fx.online
ReplyA very engaging and informative article. Readers who want more details could visit https://bkuresults01.com
ReplyI appreciate how the website balances aesthetic appeal with practical usability. https://rehber-fx.online
ReplyI love the modern and fresh look that makes exploring the site enjoyable. https://rehber-fx.online
ReplyThis is a truly insightful read! I really appreciate the depth of research and effort you put into explaining this topic so clearly. Keep up the fantastic work https://bulldog-house.com
ReplyYour unique perspective and clear explanations really added value to the topic. Thank you for sharing such quality content. Feel free to check out my website at https://chrishappens.com
ReplyThis website looks very clean with elegant layout fast browsing helpful information and reliable performance that makes visitors enjoy every moment here https://frafiro.com
ReplyI found the pacing of this article very comfortable. More resources can be explored at https://brandsonsalemall.us
ReplyOne of the most enjoyable reads I have had this week. For something equally enjoyable in your spare time, head over to mdnslot and see what all the excitement is about.
ReplyThe design makes it easy to explore different sections without feeling overwhelmed. https://octopus-quatuorvocal.com/
ReplyI really enjoyed reading this. You explained everything so clearly. I also found more useful insights on https://molanaacademy.com
ReplyI really enjoyed reading this. You explained everything so clearly https://molanaacademy.com
ReplyYour writing has a unique charm that draws readers in effortlessly. would love to have someone with your taste visit my website MDNSLOT
ReplyThis made the topic feel less complex than I initially thought it would be. https://ctyazgroup.com has that same ability to make things feel more manageable than expected.
ReplyGood content that did not try to oversell itself at any point throughout. https://westafricanway.top has that same understated and genuine quality that I find really appealing.
ReplyThis left me with no unanswered questions which is a sign of good writing. https://rtechsmart.com leaves me feeling that same sense of completeness after every visit.
ReplyReally easy to get into and just as easy to finish without any effort. https://cloudcomments.net is just as easy to get into and I always end up spending more time than planned.
ReplyYour content never disappoints. This article is well structured and full of value. I also recommend taking a look at https://finishlinehypebeast.club/
ReplyI truly appreciate this content article. Its full of valuable information and presented beautifully. I also recommend checking out https://sinaedufoundation.org/
ReplyGreat job on this post. Its informative, easy to follow, and very useful. I also recommend readers take a look at https://globalearning.in/
ReplyThis platform offers a great experience with its combination of visual appeal and usability. https://franchisesushisakura.com/
ReplyI really appreciate how user friendly this website is, offering clear navigation and a clean interface that enhances the overall browsing experience. https://shizo.tech/
ReplyThis was such an insightful and well-written article. I appreciate the effort you put into making the topic easy to understand. I also publish articles in a similar niche, and I’d be happy if you could visit my website and check them out too https://paper-io.one/
ReplyVery nice article! Your ideas are presented with confidence and clarity, which makes the whole piece very enjoyable. I appreciate the value you provide here. I also publish articles on my website, and I’d be glad if you visited it too https://imghost.online/
ReplyThis is a very strong and well-written article. I especially liked how you made the content both educational and enjoyable. I also share articles on similar subjects on my site, and I’d love for you to visit and see them https://roadtriptheworld.com/
ReplyI admire your dedication to inclusivity on your site. It makes everyone feel valued and represented! https://particl.wiki/
ReplyYour tutorials are not only educational but also fun! They make learning feel like an enjoyable adventure. https://madhappyclothing.org/
ReplyThis is one of the best websites I've ever visited! The content is rich, and it’s laid out in such an accessible way. https://binconsultores.com/
ReplySaved this to read later and ended up going through it right away instead. https://warehousedelaware.top had the same effect on me when it landed in my feed.
ReplyPassed this along to a few people who have been asking about this subject. I included https://dotkomthinkers.com in the same message for a bit of extra reading.
ReplyWrapped up reading this and felt like I actually understood the topic better. https://frankvannuus.com helped me get there too when I went through it earlier.
ReplyRead a lot of content in this area and this sits near the top of the list. I put https://bioadderallpharma.com in the same tier after spending time with it recently.
ReplyThis is a great article, and I love how you present your ideas so clearly. I also found https://bronxpages.com helpful for other related content
ReplyVery nicely written. The article is informative, engaging, and easy to digest. Anyone interested in similar topics may also enjoy https://clomidonline.site
ReplyThis is the kind of content that sticks with you. Impeccable quality from top to bottom, well done. Stay awesome, and pop over to https://kaizen4training.com for a curated collection of similar excellence
ReplyI love the consistent updates and lively discussions featured here creating an engaging atmosphere that keeps me informed and entertained. https://aethernet.online/
ReplyThis website is an excellent resource for continuous learning and staying informed about current issues. https://preslisa.de/
ReplyI value the consistent quality and professionalism seen in all articles on this website. https://preslisa.de/
ReplyThis was a very valuable read. I like how you presented the information in a simple yet meaningful way. Keep up the great work. I also manage a website with related content KOPERASITOGEL and I would love for you to check it out
ReplyGreat work on this website! The layout is attractive, the content is valuable, and everything feels very professional. I appreciate the effort behind this platform. Please feel free to visit our website too someday KOPERASITOGEL
ReplyThis article was really pleasant to read. Thank you for putting this together and sharing it with everyone. I also have a related website KOPERASITOGEL feel free to check it out
ReplyThis post is very informative and easy to read. Thanks for sharing your insights. A similar website is also worth checking out 5DEWA
ReplyPost a Comment