Add constructor-level customization of columns and sorting in datagrids.
Review Request #14818 — Created Feb. 16, 2026 and updated
Datagrids have historically allowed for custom column selection/ordering
and sorting via HTTP GET query strings. This works great in the case
where you want to display a standard datagrid page with user choices,
but less so when you want to handle providing these options through
other means.This change introduces new
columnsandsortarguments to the
DataGridconstructor. These both take lists of strings, and behave the
same way that the query string versions do. They can also takeNone,
which will force usage of the datagrid defaults.This not only overrides (and disables) anything in the querystring, but
also prevents both loading from and saving to the user profile.
Unit tests pass.
Tested with some in-progress code using specially-constructed datagrids,
and verified I could define the columns and sort order.
| Summary | ID |
|---|---|
| a077d3ae3d5ccae704ea497cbb461dca45cb540e |
| Description | From | Last Updated |
|---|---|---|
|
In the change description, you say a None value forces usage of the datagrid defaults. Can we add unit tests … |
|
|
|
These were wrong previously, but both should be typed as str | None. |
|
|
|
Since you removed the part of the docstring about returning bool, can we update this to just return list[str]? |
|