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.Paging(pager_on: bool = False, per_page: int | None = None, on_page: int | None = None)[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
Grid Types¶
- class webgrid.types.FilterOperator(key: str, label: str, field_type: str | None, hint: str | None = None)[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.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]¶