[CLOSED] TreeGrid submit dirty rows

  1. #1

    [CLOSED] TreeGrid submit dirty rows

    Hi,

    i have a TreeGrid without Store but with some columns with an editor. I can edit the data and the cell is marked as dirty.

    Now i want to save the data. Is it possible to get all dirty rows as one Parameter?

    <ext:Button runat="server" Icon="Disk" Text="Save">
                                <DirectEvents>
                                    <Click OnEvent="SaveAllDirtyValues" >
                                        <ExtraParams>
                                            <ext:Parameter Name="RowValues" Value="#{TreeGrid1}.getValues({dirtyValuesOnly:true})" Mode="Raw" Encode="true" />
                                        </ExtraParams>
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
    best regards
    I.
    Last edited by Daniil; Dec 10, 2014 at 9:37 AM. Reason: [CLOSED]
  2. #2
    Hi @IMehl,

    Welcome to the Ext.NET forums

    Please look at this example:
    https://examples2.ext.net/#/GridPanel/Update/Batch/

    There is the following Button:
    <ext:Button runat="server" Text="Sync" Icon="Disk">
        <DirectEvents>
            <Click OnEvent="SaveClick" Before="return #{Store1}.isDirty();">
                <ExtraParams>
                    <ext:Parameter Name="data" Value="#{Store1}.getChangedData()" Mode="Raw" Encode="true" />
                </ExtraParams>
            </Click>
        </DirectEvents>
    </ext:Button>
    Here is the SaveClick method.
    protected void SaveClick(object sender, DirectEventArgs e)
    {
        ChangeRecords<TestPerson> persons = new StoreDataHandler(e.ExtraParams["data"]).BatchObjectData<TestPerson>();
    
        foreach (TestPerson created in persons.Created)
        {            
            this.AddPerson(created);
    
            ModelProxy record = Store1.GetByInternalId(created.PhantomId);            
                
            //remember record instance in variable to avoid searching on each method calling
            record.CreateVariable = true;
                
            record.SetId(created.Id);
            record.Commit();
            created.PhantomId = null;
        }
    
        foreach (TestPerson deleted in persons.Deleted)
        {
            this.DeletePerson(deleted.Id.Value);
            Store1.CommitRemoving(deleted.Id.Value);            
        }
    
        foreach (TestPerson updated in persons.Updated)
        {
            this.UpdatePerson(updated);
            Store1.GetById(updated.Id.Value).Commit();
        }
    }
    I would try this technique for a TreePanel as well.

    As for not having TreeStore, it exists internally anyways.
    <ext:Parameter Name="data" Value="App.TreePanel1.getStore().getChangedData()" Mode="Raw" Encode="true" />
  3. #3
    Hi Daniil,

    thanks for your answer. It works fine so far. But in the TreeStore "Store1" there are no methods like
    - GetByInternalId
    - CommitRemoving
    - GetById

    And there is no .isDirty() function in the TreeStore.

    <ext:Button runat="server" Text="Sync" Icon="Disk">
          <DirectEvents>
                <Click OnEvent="SaveAllValues" Before="return #{TreeGrid1}.getStore().isDirty();">
                      <ExtraParams>
                           <ext:Parameter Name="RowValues" Value="#{TreeGrid1}.getStore().getChangedData()" Mode="Raw" Encode="true" />
                      </ExtraParams>
                </Click>
           </DirectEvents>
    </ext:Button>
    These are only in the Store control. Has a TreeStore comparable methods?

    best regards
    I.
    Last edited by IMehl; Dec 04, 2014 at 6:04 AM.
  4. #4
    Yes, it looks the TreeStore API is not quite ready for the Batch style of saving. Sorry for misleading you.

    We recommend to consider a regular ExtJS saving mechanism.
    https://examples2.ext.net/#/search/saving+variations
    https://examples2.ext.net/#/GridPanel/Update/AutoSave/

    The examples are for GridPanels, but it should work for TreePanels.

    There is an alternative approach also built for TreePanels specifically.
    https://examples2.ext.net/#/TreePane...d/Remote_Mode/
    https://examples2.ext.net/#/TreePane..._with_Service/
  5. #5
    Thanks, please mark this case as closed

    best reagrds
    I.

Similar Threads

  1. Rows of gridpanel in a object in formpanel submit
    By Douglas Feitosa in forum 1.x Help
    Replies: 0
    Last Post: Jan 31, 2013, 10:35 AM
  2. Replies: 2
    Last Post: Dec 06, 2010, 2:07 PM
  3. [CLOSED] Submit gridpanel data in form submit
    By jchau in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 14, 2010, 7:25 PM
  4. [CLOSED] Update only dirty rows of gridpanel
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 25, 2010, 2:00 PM
  5. Finding dirty rows in a gridpanel
    By Kamal in forum 1.x Help
    Replies: 2
    Last Post: Aug 16, 2009, 9:51 AM

Tags for this Thread

Posting Permissions