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: Union[str, List[str]], value2: Union[str, NoneType] = None)[source]
class webgrid.types.Paging(pager_on: bool = False, per_page: Union[int, NoneType] = None, on_page: Union[int, NoneType] = None)[source]
class webgrid.types.Sort(key: str, flag_desc: bool)[source]
class webgrid.types.GridSettings(search_expr: Union[str, NoneType] = None, filters: Dict[str, webgrid.types.Filter] = <factory>, paging: webgrid.types.Paging = <factory>, sort: List[webgrid.types.Sort] = <factory>, export_to: Union[str, NoneType] = 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: Union[str, NoneType], hint: Union[str, NoneType] = None)[source]
class webgrid.types.FilterOption(key: str, value: str)[source]
class webgrid.types.FilterSpec(operators: List[webgrid.types.FilterOperator], primary_op: Union[webgrid.types.FilterOperator, NoneType])[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]