ASPxClientGridViewBatchEditApi.GetUnsavedChanges Method
Returns an object that stores unsaved changes.
Declaration
GetUnsavedChanges(): any
Returns
Type | Description |
---|---|
any | An object that stores unsaved changes. |
Remarks
Call the client-side GetUnsavedChanges
method to get information about updated, inserted, and deleted data in the grid. This method uses key values to identify updated and deleted rows, and visible indexes to identify inserted rows.
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" KeyFieldName="CustomerID"
ClientInstanceName="ClientGrid">
<Columns>
<dx:GridViewCommandColumn ShowDeleteButton="True" ShowNewButtonInHeader="True" VisibleIndex="0" />
<dx:GridViewDataTextColumn FieldName="CustomerID" VisibleIndex="1" />
<dx:GridViewDataTextColumn FieldName="CompanyName" VisibleIndex="2" />
<dx:GridViewDataTextColumn FieldName="ContactName" VisibleIndex="3" />
<dx:GridViewDataTextColumn FieldName="City" VisibleIndex="5" />
<dx:GridViewDataTextColumn FieldName="Country" VisibleIndex="6" />
</Columns>
<SettingsEditing Mode="Batch" />
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Get unsaved changes" AutoPostBack="false">
<ClientSideEvents Click="OnClick" />
</dx:ASPxButton>
function OnClick(s, e) {
var batchEditChanges = ClientGrid.batchEditApi.GetUnsavedChanges();
// ...
}
The hash table below shows the values that the GetUnsavedChanges
method returns when a user deletes, inserts, or updates grid rows in batch edit mode.
deletedValues:
ANTON: {1: 'ANTON', 2: 'Antonio Moreno Taquería', 3: 'Antonio Moreno', 4: 'México D.F.', 5: 'Mexico'}
AROUT: {1: 'AROUT', 2: 'Around the Horn', 3: 'Thomas Hardy', 4: 'London', 5: 'United Kingdom'}
insertedValues:
-1: {1: 'TEST2', 2: 'Bon app', 3: 'Hanna Moos', 4: null, 5: 'Germany'}
-2: {1: 'TEST1', 2: null, 3: 'Alex Fisher', 4: null, 5: null}
updatedValues:
ALFKI: {4: 'Stuttgart'}
ANATR: {2: 'Ana Trujillo Emparedados'}
You can also use the deletedValues, insertedValues, and updatedValues argument properties of the client-side BatchEditChangesSaving event to get information about deleted, inserted, and updated rows in the grid.
For more information on the grid in batch edit mode, refer to the following topic: ASPxGridView - Batch Edit Mode.