Export Dialog

Style-agnostic export dialog component.

python 9 params

Preview

open

Export Data

Format

Columns

python
export_dialog(open=True, formats=['csv', 'xlsx', 'json'], columns=[{'id': 'name', 'label': 'Name'}, {'id': 'email', 'label': 'Email'}, {'id': 'joined', 'label': 'Joined', 'checked': False}])

Usage

views.py
python
from djust import LiveView
from djust.decorators import event_handler
from djust.components import ExportDialog


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = ExportDialog(open=True, formats=['csv', 'xlsx', 'json'], columns=[{'id': 'name', 'label': 'Name'}, {'id': 'email', 'label': 'Email'}, {'id': 'joined', 'label': 'Joined', 'checked': False}])

    @event_handler()
    def close_export(self, value=None, **kwargs):
        ...  # write to self.component; the re-render carries it

    @event_handler()
    def export(self, value=None, **kwargs):
        ...  # write to self.component; the re-render carries it
my_template.html
django
{{ component }}

Events this component sends to the view: close_export, export.

Parameters

NameTypeDefault
formatslist | NoneNone
columnslist | NoneNone
eventstr — renames the event; identity is `name`'export'
openboolFalse
close_eventstr — renames the event; identity is `name`'close_export'
selected_formatstr''
titlestr'Export Data'
custom_classstr''
**kwargs— passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state
Source & styles
FilePathNotes
moduledjust.components.components.export_dialogSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 14 of this component's classes at line 1885, 1886, 1887, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 2641. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/catalogue.cssDefines 2 of this component's classes at line 158, 162. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/components.cssDefines 1 of this component's classes at line 1537. Override those rules, or the custom properties they read, in a stylesheet loaded after it.