“Unable to get property ‘defaultDialogWidth’ of undefined or null reference” on SharePoint Modal Popup

Error message “Unable to get property ‘defaultDialogWidth’ of undefined or null reference ” was thrown when trying to load modal popup on a page where very less of CSOM related script loaded.  In case you haven’t set width or height it is suppose to pick the default value for height and width.  It happens to be all the default values used by most JSOM are loaded from a resource file. 

To be precised, the js library that has the method to load the modal popup  “SP.UI.Dialog.js” has a dependency to the “SP.Res” namespace from where it will pick all the defaults from. 

                                       LoadSodByKey(“sp.res.resx”, function(){
                                          LoadSodByKey(“dialogUI”, function () {

                                            SP.UI.ModalDialog.showModalDialog({url : ‘/sites/abc.aspx’, title: ‘My Page’});         
                                          });
                                        });

Simple but may not be the perfect solution for this it forcefully loading the sp.res.resx resource file content with “LoadSodByKey”.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s