Skip to content

Batch Editing with Conflict Resolution: Review Original, Pending, and Server Values Before Saving ​

Order grid with pending edits and a conflict review comparing original, edited, and server values.

A batch-editing data grid lets users stage many edits and save them together. But a save button does not solve concurrent editing. If another user has modified one of the same records, the editor needs to explain the conflict, preserve the draft and let the user review the current server values before retrying.

In a remote grid, use a conditional, atomic write and a three-way comparison: the value the user started from, the value they want to save, and the latest authoritative value. RevoGrid Pro's batch conflict receipt and review controls implement the client-side workflow; your backend must enforce the concurrency policy.

A conflict is different from a validation error ​

Consider an order that was originally New when an operator loaded the page at revision 42. The operator sets it to Ready, but a warehouse service changes it to Shipped before the operator presses Save.

RecordOriginal (revision 42)PendingServer (revision 43)
Notebook, statusNewReadyShipped
Notebook, quantity242

A field may be valid in isolation yet invalid in the current record state. Ready is a legitimate status, but reopening a shipped order might violate a workflow rule. The grid must not silently overwrite Shipped or discard the user's quantity edit.

A useful review lets the operator choose whether to retain or discard each conflicting draft value. In the example, retaining the non-conflicting quantity edit does not imply the server must accept it: the server still checks the complete rebased transaction against the latest business rules.

Design the write protocol before the UI ​

Use stable record IDs for server writes. A row's page position is not a database key. Include a revision or equivalent concurrency token and a stable operation ID so that retrying an uncertain request can return the previous result instead of applying the same write again.

A typical exchange looks like this:

StepClientServer
1Load rows and revision 42Return authorized records
2Stage edits locallyNo write
3Submit operation A with expected revision 42Check revision atomically; reject without writing
4Show original, draft and current valueReturn revision 43 and conflicting cells
5Apply reviewed choicesNo write yet
6Submit rebased operation B against revision 43Validate and commit atomically, or return another conflict

The operation ID changes when the reviewed draft changes. If a network failure leaves the result unknown, retrying the unchanged transaction should reuse the same operation ID. The server should persist a receipt associated with that ID and its authorized write scope. It must reject reuse of the ID with a different payload.

Implement a conflict-aware commit in TypeScript ​

This example uses a custom HTTP endpoint. The JSON contract below is application-owned; it is not a built-in RevoGrid service. The endpoint must perform revision checks, field-level authorization, validation and updates in one database transaction. A 409 response must mean that none of the submitted writes took effect.

The released Pro API is BatchEditingConfig.commit, which accepts the transaction and an abort signal. A conflict response is mapped to the submitted source coordinates only after identifying the conflicting server record by ID.

ts
import type {
  BatchEditingConfig,
  BatchEditConflictReceipt,
} from '@revolist/revogrid-pro';

type ConflictResponse = {
  revision: string;
  authoritative: Record<string, Record<string, unknown>>;
};

export function orderBatch(
  getLoadedRevision: () => string,
): BatchEditingConfig {
  return {
    remotePagination: true,
    async commit(transaction, signal) {
      // This endpoint handles cell updates only, not row inserts/deletes.
      if (transaction.insertions.length || transaction.deletions.length) {
        return false;
      }
      const cells = transaction.cells;
      const response = await fetch('/api/orders/batch', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        signal,
        body: JSON.stringify({
          operationId: transaction.operationId,
          expectedRevision: transaction.expectedRevision ?? getLoadedRevision(),
          changes: cells.map(({ model, prop, previousValue, value }) => ({
            id: model.id,
            field: prop,
            previousValue,
            value,
          })),
        }),
      });

      if (response.status === 409) {
        const conflict = await response.json() as ConflictResponse;
        const receipt: BatchEditConflictReceipt = {
          status: 'conflict',
          revision: conflict.revision,
          cells: cells.flatMap(({ model, prop, sourceIndex }) => {
            const current = conflict.authoritative[String(model.id)] ?? {};
            return Object.hasOwn(current, prop)
              ? [{ sourceIndex, prop, currentValue: current[prop] }]
              : [];
          }),
        };
        // Do not report a structural or unrelated conflict as a cell conflict.
        return receipt.cells.length ? receipt : false;
      }
      if (!response.ok) throw new Error('Order batch save failed');
      return true;
    },
  };
}

Here authoritative is defined to contain only the fields requiring review, not every field of every submitted row. In production, validate the response schema at the network boundary and reject malformed or ambiguous receipts. A revision mismatch caused by structural changes or a removed record may require reloading the data and starting a new batch.

Place the review controls in a React screen ​

Use the remote pagination guide to set up the page loader and its current revision. Add BatchEditingPlugin to the existing remote grid; the controls use the nearest GridControlsProvider. This component is an integration fragment: the grid supplied as its child must already use the remote source, plugin and config shown below.

tsx
import type { PropsWithChildren } from 'react';
import {
  GridControlsProvider,
  BatchEditingControls,
} from '@revolist/revogrid-pro/react';
import '@revolist/revogrid-pro/styles.css';

export function OrderEditingPanel({ children }: PropsWithChildren) {
  return (
    <GridControlsProvider>
      <BatchEditingControls />
      {children}
    </GridControlsProvider>
  );
}

Configure the mounted grid alongside the existing PaginationPlugin and its remote data provider:

ts
import { BatchEditingPlugin } from '@revolist/revogrid-pro';

export function connectOrderEditing(
  grid: HTMLRevoGridElement,
  getLoadedRevision: () => string,
) {
  grid.batchEditing = orderBatch(getLoadedRevision);
  grid.plugins = [...(grid.plugins ?? []), BatchEditingPlugin];
}

Install the plugin once during setup, not on every React render. The controls expose the staged changes and, after a conflicting receipt, let the user compare the original, pending and server values. Review choices default to Keep, so explicitly examine each conflict and apply the choices before saving again.

The standard workflow keeps non-conflicting pending edits. If every draft value is replaced by the server value, use Refresh grid to fetch authoritative data. Keep the same loaded page while reviewing the rebased draft; do not stage new edits until the rebased save is finished.

Try a concurrent update ​

Open the remote batch conflict example. Its sample server changes Notebook to Shipped while you stage Ready. The example provides a deterministic exercise without two browser sessions.

  1. Start a batch, set Notebook to Ready and save.
  2. Verify that the draft remains open and that all three values are shown.
  3. Choose the server value, apply the review and refresh if no pending cells remain.
  4. Repeat with Keep, apply the review and save against the reviewed revision.
  5. In your own backend test, inject another update between review and save. Verify that the second conflict does not overwrite that update.

Also test timeout after commit, a duplicate operation ID, forbidden fields, missing rows, and a query change during review. Assert the database and returned revision, not just the grid's displayed value.

When to use batch history and when to use a server command ​

RevoGrid's local accepted batch can become a single undo step. Remote pagination acceptance does not create a local history entry. Reversing a saved remote batch is a new conditional write, not just restoring the old browser snapshot.

Use a backend transaction that checks current values again, or an application-owned history command. See the History guide for the separate external replay contract.

Compare the editing contracts ​

AG Grid batch editing provides pending values and commit/cancel for the Client-Side Row Model, with committed batches integrated into edit history. Syncfusion batch editing also provides bulk save, confirmation and in-session undo/redo.

Those are useful mechanisms for staged edits. A separate question is how a remote concurrency conflict gets resolved. RevoGrid's documented three-value review and reviewed-revision retry provide an explicit client integration for that workflow. Other products can implement a comparable workflow with custom data adapters and review UI; the server's transaction semantics remain necessary in every case.

Explore remote batch editing, data grid server-side pagination and the Pro trial.

See the broader AG Grid alternative and Syncfusion alternative comparisons.