[CLOSED] Show Mask using javascript.

  1. #1

    [CLOSED] Show Mask using javascript.

    Hi,

    I have to show mask while calling direct method from javascript and the mask should hide after complete the direct method. I have implemented following way, but the mask is not show. I think the functionality is working, means showing and hiding of mask is working, but it is not showing depending on the direct method execution time. Can you please let me know how to show mask until direct method execution time?

    var RemoveTask = function (cmd, taskid, appid, taskname) {
                if (cmd == "CmdDelTask") {  
                   var loadmask = new Ext.LoadMask(Ext.getBody(), { msg: "Please wait..." });              
                    loadmask.show();
                    Ext.net.DirectMethods.DeleteTask(taskid, appid, taskname);
                    loadmask.hide();
                }
    Last edited by Daniil; Nov 09, 2011 at 5:36 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    Please wrap the code in [CODE] tags, see:
    Forum Guidelines For Posting New Topics
  3. #3
    Hi Daniil,

    Sorry I forgot to add Code tags

    
    var RemoveTask = function (cmd, taskid, appid, taskname) {
    if (cmd == "CmdDelTask") { 
    var loadmask = new Ext.LoadMask(Ext.getBody(), { msg: "Please wait..." }); 
    loadmask.show();
    Ext.net.DirectMethods.DeleteTask(taskid, appid, taskname);
    loadmask.hide();
    }
    }
    Quote Originally Posted by Daniil View Post
    Hi,

    Please wrap the code in [CODE] tags, see:
    Forum Guidelines For Posting New Topics
  4. #4
    To don't duplicate a post you can use the "Edit Post" button.

    Regarding the question.

    You should hide a mask in a success/failure handler of a DirectMethod.
    Ext.net.DirectMethods.DeleteTask(taskid, appid, taskname, {
        success : function () {
            loadmask.hide();
        },
        failure : function () {
            loadmask.hide();
        }
    });
  5. #5
    try:
    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
        [DirectMethod]
        public bool TestDemoShowMask()
        {
            if (DateTime.Now.Second % 2 == 1)
                return true;
            return false;
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>DemoShowMask</title>
    </head>
    <body>
        <ext:ResourceManager runat="server">
        </ext:ResourceManager>
    <ext:Button runat="server" ID="DemoShowMask" Text="DemoShowMask">
        <Listeners>
            <Click Handler="Click_DemoShowMask()" />
        </Listeners>
    </ext:Button>
        <script language="javascript" type="text/javascript">
            function Click_DemoShowMask() {
            var loadmask = new Ext.LoadMask(Ext.getBody(), { msg: "Please wait..." });
            loadmask.show();
                Ext.net.DirectMethods.TestDemoShowMask({
                    success: function (a,b,c) {
                        if(a==true)
                        {
                            loadmask.hide();
                        }
                        else
                        {
                            loadmask.hide();
                        }
                    },
                 
                });
            }
        </script>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Show Mask When submitData
    By imaa in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 24, 2011, 7:48 AM
  2. GridPanel + show mask via javascript
    By Birgit in forum 1.x Help
    Replies: 0
    Last Post: Sep 22, 2010, 8:47 AM
  3. show mask
    By l0vl0v in forum 1.x Help
    Replies: 1
    Last Post: Jan 14, 2010, 1:05 PM
  4. Show a mask from codebehind
    By locoperoguapo in forum 1.x Help
    Replies: 0
    Last Post: Apr 13, 2009, 4:05 PM
  5. [CLOSED] Show mask on listener function
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 15
    Last Post: Apr 01, 2009, 8:28 AM

Tags for this Thread

Posting Permissions