I've created a SHP 2013 Sharepoint-Hosted App on visual studio.
On my App.js that's created by default, i have the following lines to show a Modal Dialog
var options = { url: 'http://www.google.com', width: 400, height: 300 };
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
It works as intended, the little dialog is shown correctly.
After that, i've created a new Client Web Part (App Part) on visual studio, and on the aspx file for my app part i have the same JS lines
<script type="text/javascript">
var options = { url: 'http://www.google.com', width: 400, height: 300 };
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
</script>
But this time it returns an error saying the reference to the property 'execute' is null or undefined.
Is it possible to invoke a modal window from within a App Part? What changes from invoking it from the Default page of my app?
Thanks in advance.
"../Scripts/jquery-2.0.1.min.js" "http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js" "/_layouts/15/SP.RequestExecutor.js" "/_layouts/15/SP.Runtime.js" "/_layouts/15/SP.js"
For what i've read on MSDN, app parts can't have any control over the parent window, like opening a modal dialog.
:(
– C. Hoffmann Jun 11 '13 at 20:28parent.SP.SOD.execute('...');I hope this will work. – ggobbe Jun 13 '13 at 10:39