javascriptjquerydynamics-crmspin.jseditablegrid

manually create spinning activity indicators


I apologize if this question is answered somewhere, but I couldn't find it.

I am working on editable javascript grid for MS Dynamics CRM and I am trying to display loading screen when user clicks "Save" button on the grid (the loading spinner should only be covering my grid - which is actually a HTML web resource displayed inside the CRM window). It takes about 2-5 seconds until CRM system saves the data and reloads my grid. So I want to display the loading screen during that time.

I found spin.js http://spin.js.org/ and it seems that it can be easily implemented but I am failing to realize on what event should I display the loading screen?

Basically, I have a table and when user clicks "Save" or "Delete" button, I wish to show that there is something going on under the hood.

Thank you very much for you time and help!


Solution

  • It sounds like you know what you want to call from spin.js, you're just trying to figure out where to call it from. You can try adding this to your javascript, where "#saveButton" and "#deleteButton" are the css identifiers for the buttons you want to fire the script off of.

        $("#saveButton").click(function(){
            displayLoadingPage();
        });
    
        $("#deleteButton").click(function(){
            displayLoadingPage();
        });
    
        function displayLoadingPage() {
            //call your spin.js code here.
        }
    

    Let me know if this answers what you were getting at.