Add JSON serialization of datagrids.

Review Request #14819 — Created Feb. 16, 2026 and updated

Information

Djblets
release-5.x

Reviewers

Datagrids can now be serialized to JSON, providing information on active
and available columns, pagination, sorting information, rows, and each
cell within. The cells contain both rendered HTML (the <td> and
everything inside) and a JSON value for processing.

This can be used to provide datagrid functionality in other contexts.
The primary purpose at this time is to enable API access to datagrids.
The information can be returned as-is or further processed to provide
a more integrated response into an API response format.

Columns can provide an explicit JSON value alongside rendered HTML. Both
now default to making use of a new get_raw_object_value(), which can
provide a suitable value from an object. This is intended for column
implementations to override and use as necessary, and to simplify common
code used for render_data() and to_json().

Unit tests pass.

Summary ID
Add JSON serialization of datagrids.
Datagrids can now be serialized to JSON, providing information on active and available columns, pagination, sorting information, rows, and each cell within. The cells contain both rendered HTML (the `<td>` and everything inside) and a JSON value for processing. This can be used to provide datagrid functionality in other contexts. The primary purpose at this time is to enable API access to datagrids. The information can be returned as-is or further processed to provide a more integrated response into an API response format. Columns can provide an explicit JSON value alongside rendered HTML. Both now default to making use of a new `get_raw_object_value()`, which can provide a suitable value from an object. This is intended for column implementations to override and use as necessary, and to simplify common code used for `render_data()` and `to_json()`.
3fbcb7f5fd9f71ed1c49e2acb314f30950c8121b
Checks run (2 succeeded)
flake8 passed.
JSHint passed.