[CLOSED] How to "commit" changes to Grid on the client side?

  1. #1

    [CLOSED] How to "commit" changes to Grid on the client side?

    Hi,

    I have a master-detail GridPanel / FormPanel relationship on the page. On the click of the "Save" button, I now do three things:

    <ext:Button ID="ButtonSave" runat="server" Text="Save" Icon="Disk">
        <DirectEvents>
            <Click Before="updateRecord(#{FormPanel1});" OnEvent="ButtonSave_Click" After="#{GridPanel1}.store.reload();">
                <EventMask ShowMask="true" />
            </Click>
        </DirectEvents>
    </ext:Button>
    
    <head runat="server">
        <script type="text/javascript">
            var updateRecord = function (form) {
                if (form.record == null) {
                    return;
                }
    
                form.getForm().updateRecord(form.record);
            };
        </script>
    </head>
    
    <script runat="server">
            protected void ButtonSave_Click(object sender, DirectEventArgs e)
            {
                // Commit the changes to the database
            }
    </script>
    The call to updateRecord() obviously updates the corresponding record in the GridPanel with the changes from the FormPanel. At that point, the Grid is in uncommitted state. So even after the saving code in the button click DirectEvent is executed, I have to reload the Grid store in the "After" handler to avoid viewing the "You have uncommitted changes..." message when manually refreshing the Grid.

    Is there any call to client "commit" the changes to the Grid?

    Thanks,

    Vadym
    Last edited by Daniil; Feb 02, 2012 at 3:25 PM. Reason: [CLOSED]
  2. #2
    Hi,

    The Store has the commitChanges method.
    http://docs.sencha.com/ext-js/3-4/#!...-commitChanges
  3. #3
    Thanks much Daniil!

    That was it.

    <head runat="server">
        <script type="text/javascript">
            var updateRecord = function (form) {
                if (form.record == null) {
                    return;
                }
     
                form.getForm().updateRecord(form.record);
                var grid = Ext.getCmp('GridPanel1');
                grid.store.commitChanges();
            };
        </script>
    </head>
    Vadym

Similar Threads

  1. [CLOSED] How does "MaskCls" work for "AutoLoad" mask in panel control
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jul 19, 2012, 12:09 PM
  2. Replies: 1
    Last Post: Jun 26, 2012, 11:29 AM
  3. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  4. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM
  5. [CLOSED] MultiSelect "select all" from client side
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Sep 20, 2011, 12:04 PM

Posting Permissions