Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have created a Visual Web part in SharePoint 2013. Web part is used for showing list data from different list. For loading list data on web part we have used SPServices. We have written code under $(document).ready function so when web part loads, data will pull from lists and displayed on the screen. For loading list data it may takes 1-2 minutes so I want to show SharePoint Modal dialog(waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Loading...', 'Please wait while data is fetching from Lists...', 76, 330);). Which will show user the wait screen with spinning icon. So user will not be able to click on background/Page.

But main issue is that when I am calling SharePoint modal dialog it is not showing on page, it hides somewhere (when pulling data from different list). If suppose I have used alert message after calling SharePoint Modal dialog it shows the SharePoint Modal dialog suddenly. I am confused about this behavior. How should I sort out this issue please guide me.

Any help will be appreciable.

Below is the code,
JavaScript
$(document).ready(function () {        

    ExecuteOrDelayUntilScriptLoaded(function(){

            //For Opening Sharepoint Modal Dialog

            waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Loading...', 'Please wait while data is fetching from Lists...', 76, 330);

           //Code which will get data from different list and show on web part using SPServices   



           //For Closing Sharepoint Modal Dialog           
           waitDialog .close(); 

    }, "sp.js");

});

Thanks,
Nitin
Posted
Updated 27-Nov-15 1:39am
v2
Comments
Pradip R 9-Dec-15 0:23am    
This kind of issue occurred with me as well. So in that case I have added my own loader and shown it to the end user when webpart is being loaded. Your code doesn't have any error but sometimes the behavior is causing the issue. So I would suggest you to have custom loader or place setTimeout in your current loader to check whether it is working or not.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900