Types

Types are defined for grid JSON input/output. These can be mirrored on the consumer side for API integrity (e.g. in TypeScript).

Typically, in API usage, the consumer app will be building/maintaining a GridSettings object to send to the API, and accepting a Grid in response.

Settings Types

class webgrid.types.Filter(op: str, value1: str | list[str], value2: str | None = None)[source]
class webgrid.types.Paging(pager_on: bool = False, per_page: int | None = None, on_page: int | None = None)[source]
class webgrid.types.Sort(key: str, flag_desc: bool)[source]
class webgrid.types.GridSettings(search_expr: str | None = None, filters: dict[str, webgrid.types.Filter] = <factory>, paging: webgrid.types.Paging = <factory>, sort: list[webgrid.types.Sort] = <factory>, export_to: str | None = None)[source]
classmethod from_dict(data: dict[str, Any]) GridSettings[source]

Create from deserialized json

to_args() dict[str, Any][source]

Convert grid parameters to request args format

Grid Types

class webgrid.types.ColumnGroup(label: str, columns: list[str])[source]
class webgrid.types.FilterOperator(key: str, label: str, field_type: str | None, hint: str | None = None)[source]
class webgrid.types.FilterOption(key: str, value: str)[source]
class webgrid.types.FilterSpec(operators: list[webgrid.types.FilterOperator], primary_op: webgrid.types.FilterOperator | None)[source]
class webgrid.types.GridSpec(columns: list[dict[str, str]], column_groups: list[webgrid.types.ColumnGroup], column_types: list[dict[str, str]], export_targets: list[str], enable_search: bool, enable_sort: bool, sortable_columns: list[str], filters: dict[str, webgrid.types.FilterSpec] = <factory>)[source]
class webgrid.types.GridState(page_count: int, record_count: int, warnings: list[str])[source]
class webgrid.types.Grid(settings: webgrid.types.GridSettings, spec: webgrid.types.GridSpec, state: webgrid.types.GridState, records: list[dict[str, Any]], totals: webgrid.types.GridTotals, errors: list[str])[source]