experiment_id: web-retrieval-v1
fixture_id: /docs/crud/update
mode: provenance
representation: html
origin_response_id: b96eb36489ac0f70637a56941472b66c
version: 2026-10-22
version_created_at_utc: 2026-10-22T19:49:39.582Z
version_nonce: b9c916cedaacd827d8c1c0e6638d0a90
generated_at_utc: 2026-11-27T06:51:11.145Z
response_nonce: b5806832141f3190ec481613cfdd6493
Docs Version 1

CRUD Update

ZingGrid has default behavior for update actions. There are expected inputs and outputs for an update action. You can, of course, extend or override this default behavior.

CRUD Defaults

The default send and return values for CRUD actions are:

CRUD Defaults
Action Type Response Codes Returns
Success Error
Create row POST 200 - 299 >= 400

Expected Return Contents

  1. Entire dataset
  2. Single record or ID of record
Read data GET 200 - 299 >= 400

Expects a JSON or dataset response.

Update row PUT 200 - 299 >= 400

Response is not read.

Update cell PATCH 200 - 299 >= 400

Response is not read.

Delete row DELETE 200 - 299 >= 400

Response is not read.

Top

Override Defaults

If you need to override any default update actions, you can use updateOptions to adjust all actions against the initial and subsequent fetches from the grid. You can read more about available updateOptions values here.

Remember, since value is an HTML attribute, it must be in valid JSON format and stringified.

Here is a list of available updateOptions:

{
  // to change the read method of the action to POST
  "method": "POST",
  // takes a JSON packet to be sent to the server in place of the action
  // in this case user_id is always one.
  "body": {user_id:1},
  "requestType": "application/json",
  "exclude": "",
  "headers": {"Authorization": "Basic super-secrete-key"},
  "mode": "no-cors",
  "responseType": "",
  "src": "",
  "queryString": ""
}

The body value can be a static JSON:

<!-- basic update option with static body -->
<zg-param name="updateOptions" value='{"body": {"user_id":1}}'></zg-param>

The body value can also be a function which returns an object, like so:

<!-- basic update option with function reference for body -->
<zg-param name="updateOptions" value='{"body": "_fncStringReference"}'></zg-param>
// function returns an object
function _fncStringReference(record) {
  return {
    // to change the read method of the action to POST
    method: 'POST',
    // takes a JSON packet to be sent to the server in place of the action
    // in this case user_id is always one.
    body: {user_id:1},
    requestType: 'application/json',
    exclude: '',
    headers: {"Authorization": "Basic super-secrete-key"},
    mode: 'no-cors',
    responseType: '',
    src: '',
    queryString: ''
  }
}
Top

[crud: update]