Block the delete row click until the row disappear from the grid

Posted by: maint on 17 May 2018, 11:59 pm EST

    • Post Options:
    • Link

    Posted 17 May 2018, 11:59 pm EST

    We should intercept the click in the delete command bar button, in order to show a message before the operation is done. Also, we would like to hide the ‘X’ button until the current delete operation is completed.

    We have checked your forum and got some solutions, but nothing worked. We are doing our deletion in server side, but we would need that message or hide operation happen at client side. Now it happens only after the delete command was processed, and that is useless for us.

    If that not possible, the other possibility would be to “block” the bar until the entire delete process is done and the row disappear from the screen.

    Our current problem is that, in slow connections, when we click on X button, the procedure takes a while, and nothing seems to be happening, so we continue clicking in the X button in order to delete that single row. When the page reacts, because the deletion done in server was finished, we find that we have lost as many rows as clicks we did. If we block the row until the deletion is done, that wouldn’t be allowed.

    Thank you.

  • Posted 21 May 2018, 12:36 am EST

    Hello,

    Spread command bar buttons make an Ajax call to perform an action. So is the case with it’s Delete button. Spread has two client side methods onCallbackStarted and onCallbackStopped which you can use to know when delete starts and when ends. Use the code as follows:

    
     <script lang="javascript" type="text/javascript">
    window.onload = function () {
    var spread1 = document.getElementById("<%=FpSpread1.ClientID %>");
    if (document.all) {
    // IE
       if (spread1.addEventListener) {
         // IE9
         spread1.addEventListener("CallBackStart", CallBackStart, false);
         spread1.addEventListener("CallBackStopped", CallBackStopped, false);
          } else {
         // Other versions of IE and IE9 quirks mode (no doctype set)
          spread1.onCallBackStart = CallBackStart;
          spread1.onCallBackStopped = CallBackStopped;
          }
    }
          else {
          // Firefox
          spread1.addEventListener("CallBackStart", CallBackStart, false);
          spread1.addEventListener("CallBackStopped", CallBackStopped, false);
         }
       }
        
       function CallBackStart(event) {
         if (event==null) event = window.event;
            alert("Delete start");
         }
       
       function CallBackStopped(event) {
          alert("Delete stop");
       }
    </script>
    
    

    I hope it helps.

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels