Skip to main content

Unofficial backend utilities for using Material-UI's X-Data-Grid component

Project description

MUI Data Grid

This is an unofficial toolbox to make integrating a Python web application with Material UI's data grid simpler.

Documentation

Requirements

  • Python 3.10+

Installation

Pip

python -m pip install -U mui-data-grid

or with extras:

python -m pip install -U mui-data-grid[flask]

Poetry

poetry add mui-data-grid

Usage

Integrations

Flask

#!/usr/bin/env python
# examples/main.py

from flask import Flask, jsonify
from flask.wrappers import Response

from mui.integrations.flask import (
    grid_filter_model_from_request,
    grid_sort_model_from_request,
)

app = Flask(__name__)


@app.route("/")
def print_sorted_details() -> Response:
    sort_model = grid_sort_model_from_request(key="sort_model[]")
    filter_model = grid_filter_model_from_request(key="filter_model")
    return jsonify({
            # sort_model is a list[GridSortItem]
            "sort_model[]": [model.dict() for model in sort_model],
            # filter_model is GridFilterModel
            "filter_model": filter_model.dict()
    })


if __name__ == "__main__":
    app.run()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mui_data_grid-0.1.0.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

mui_data_grid-0.1.0-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page