0

I am trying to migrate my code from Classic experience to SPfX.

My code is using the SP.UI.ModalDialog, and I have referenced successfully the MicrosoftAjax.js, SP.Runtime.js and the SP.js files in my project, and they are visible as source files in the browser developer tools. However the same approach just doesn't work for strings.js, even though I've paid attention that strings.js is located under the layouts/15/1033 folder instead of layouts/15.

I keep getting the error message

Unable to get property 'STS' of undefined or null reference

and I am unable to find strings.js within the source files of my browser developer tools.

The solutions proposed under the links below simply do not apply to SPfX:

https://joshmccarty.com/cannot-read-property-sts-of-undefined-when-using-sp-ui-modaldialog-in-sharepoint-2013/

Unable to get property 'STS' undefined or null reference - Sp.ui.dialog.js

  • I would not bother trying to fix SP.UI.ModalDialog. All it does - just display an <iframe> wrapped in a div element centered on a screen. There are so many ready available dialog boxes using for jQuery, React, etc. There is no need to waste time on this legacy dialog that has many unnecessary dependencies on SharePoint and does almost nothing useful for you. – Denis Molodtsov Apr 5 '18 at 14:40
  • hello Denis, thank you for the comment, this is a very valid point. However within the Office-UI-Fabric, which is the recommended framework for building modern SharePoint user interfaces I find nothing suitable so far. In case you have anything specific in mind, feel free to let me know. – Lachezar Stefanov Apr 5 '18 at 14:49
  • How about this dialog? plnkr.co/edit/tPZ8GJ?p=preview You have full control of the HTML and styles. If you don't like styling or something else - just modify it a little. – Denis Molodtsov Apr 5 '18 at 14:56
  • You can just add an <iframe> tag with no border in the body of this dialog. Then the only minor challenge is to detect the events that should cause this dialog to close. – Denis Molodtsov Apr 5 '18 at 15:02
  • Hello Denis, Thank you for your suggestion. In my case the opportunity to display progress, provided by showWaitScreenWithNoClose is cruicial, hence decided to take advantage of the built-in loading indicator (thechriskent.com/2017/05/22/…) agree with you, trying to update legacy components is a waste of time. – Lachezar Stefanov Apr 10 '18 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.