Controlling EventMask

  1. #1

    Controlling EventMask

    Hello everyone! I am writing an ObjectDataSource-driven form and need some help with controlling EventMask.

    So I have this form made where the store is linked to an ObjectDataSource. I got the form to load and save, and now I am working on insert functionality.
    I get the store to insert new record, load the blank record into the form and when the user enters data and click "Save", I save the record into the store, which in turn invokes save in the ObjectDataSource. The ObjectDataSource inserts the record as a new row, and generates a unique ID. Once the ObjectDataSouce is done saving new row, I have the store reload the record and the form with the new ID, and now the form displays newly created row with unique ID.

    Everything works, but my problem lies in locking the user out so they cannot mess with the form while all these things are happening in the background. What I ultimately want is to have EventMask with "Inserting Data..." pop up the moment user clicks "Save" button until the form is loaded with newly created record with the new ID.

    I have tried putting EventMask on the store insert, beforesave, save, and load events with various MinDelay value. Many times it ends up that I get either two or more different EventMasks overlap, or there are periods inbetween EventMasks where the form is freed up and the control is returned to the user and then later another EventMask kicks in.

    Using mindelay value to control EventMask timing seems silly since delay can vary and often end up eventmasks overlapping, or task ending earlier than expected and causing the form to open up, or eventmask staying up even though everything is done.

    Is there a way for me to popup an eventmask anywhere in my code, and take it down when I want?

    Here's what my code generally looks like:
    <script runat="server"> 
    protected void DummyForMask(object sender, AjaxEventArgs e)
        // This sub does nothing but to invoke Ajax event to bring eventmasking.  
        // Is there a better way to invoke eventmask without needless Ajax call?
        <asp:ObjectDataSource ID="TRDataSource" runat="server"
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            DeleteMethod="DeleteItem" InsertMethod="InsertItem" 
            onselecting="TRDataSource_Selecting" onupdating="TRDataSource_Updating">
                <asp:Parameter Name="criteria" Type="Object" />
        <ext:store runat="server" ID="CooliteStoreRequests" DataSourceID="TRDataSource" 
            GroupOnSort="True" AutoDataBind="true" >
                <ext:JsonReader runat="server">
                        <ext:RecordField Name="TRID"/>
                        <ext:RecordField Name="System"/>
                        <ext:RecordField Name="DescriptionSummary"/>
                        <ext:RecordField Name="Priority"/>
                        <ext:RecordField Name="DateSubmitted"/>
                        <ext:RecordField Name="Submitter"/>
                        <ext:RecordField Name="Phase"/>
                        <ext:RecordField Name="Description"/>
                        <ext:RecordField Name="AssignedTo"/>
                <Add Handler='function() 
                <Save Handler='function()
                                    if (#{txtID}.value == null || #{txtID}.value == "") // Reload after saving a newly created record
                <load handler=#{TRForm}.loadData(this.getAt(0));" />
                <BeforeSave OnEvent="DummyForMask">
                    <EventMask Msg="Saving Request1..." MinDelay="500" ShowMask="true"/>
                <Save OnEvent="DummyForMask">
                    <EventMask Msg="Saving Request2..." MinDelay="500" ShowMask="true"/>
                <Load OnEvent="DummyForMask">
                    <EventMask Msg="Loading Form..." MinDelay="100" ShowMask="true"/>
                        <ext:FormPanel FormID="TRForm" ID="TRPanel" runat="server" Title="TR Details"
                            Width="300" StoreID="CooliteStoreRequests">
                                <ext:formlayout runat="server" StoreID="CooliteStoreRequests" ID="FormLayOutTR" labelAlign="left">
                                    <ext:Anchor><ext:TextField runat="server" FieldLabel="TRID" ID="txtID" DataIndex="TRID" Disabled="true" Cls="x-item-disabled"/></ext:Anchor>
                                    <ext:Anchor Horizontal="98%"><ext:TextField runat="server" FieldLabel="System" DataIndex="System" ID="txtSystem"/></ext:Anchor>
                                    <ext:Anchor Horizontal="98%"><ext:TextField runat="server" FieldLabel="Description Summary" DataIndex="DescriptionSummary" ID="txtDescriptionSummary"/></ext:Anchor>
                                    <ext:Anchor Horizontal="98%"><ext:TextField runat="server" FieldLabel="Priority" DataIndex="Priority" ID="txtPriority"/></ext:Anchor>
                                    <ext:Anchor Horizontal="98%"><ext:TextField runat="server" FieldLabel="Submitter" DataIndex="Submitter" ID="txtSubmitter"/></ext:Anchor>
                                <ext:Button runat="server" Text="Insert">
                                        <Click Handler='function()
                                                        }' />
  2. #2

    RE: Controlling EventMask

    Welp, since I could not find ways to have EventMask cover all my events and inbetween, I've found it better to use Ext.Msg.progress or Ext.Msg.wait instead. (I should've looked at the examples more)
  3. #3

    RE: Controlling EventMask

    Can you post an example of what you ended up doing?

Similar Threads

  1. Replies: 2
    Last Post: Feb 02, 2012, 12:13 PM
  2. EventMask - default
    By PetrSnobelt in forum 1.x Help
    Replies: 3
    Last Post: May 18, 2011, 9:25 AM
  3. How to use a CustomTarget on an EventMask?
    By paul-2011 in forum 1.x Help
    Replies: 1
    Last Post: Aug 11, 2010, 6:31 AM
  4. Replies: 1
    Last Post: Aug 11, 2009, 1:28 AM
  5. EventMask can not works?
    By Tom.Hanks in forum 1.x Help
    Replies: 1
    Last Post: Dec 25, 2008, 3:28 AM

Posting Permissions