Skip to main content

yew_datatable_core/table/
data_table_options.rs

1//! Options for table configuration.
2//!
3//! Controls which features are enabled or disabled in the table,
4//! including sorting, filtering, pagination, selection, and more.
5
6/// Options for table configuration.
7///
8/// Each field controls whether a specific feature is enabled
9/// in the table instance.
10#[derive(Debug, Clone)]
11pub struct DataTableOptions {
12    /// Whether to enable sorting.
13    pub enable_sorting: bool,
14
15    /// Whether to enable multi-column sorting.
16    pub enable_multi_sort: bool,
17
18    /// Whether to enable filtering.
19    pub enable_filtering: bool,
20
21    /// Whether to enable global filtering.
22    pub enable_global_filter: bool,
23
24    /// Whether to enable pagination.
25    pub enable_pagination: bool,
26
27    /// Whether to enable row selection.
28    pub enable_row_selection: bool,
29
30    /// Whether to enable row expansion.
31    pub enable_expanding: bool,
32
33    /// Whether to enable column visibility.
34    pub enable_column_visibility: bool,
35
36    /// Whether to enable column ordering.
37    pub enable_column_ordering: bool,
38
39    /// Whether to enable column pinning.
40    pub enable_column_pinning: bool,
41
42    /// Whether to enable column resizing.
43    pub enable_column_resizing: bool,
44
45    /// Whether to enable row grouping.
46    pub enable_grouping: bool,
47
48    /// Debug mode.
49    pub debug: bool,
50}
51
52/// Provides default table options with all features enabled.
53impl Default for DataTableOptions {
54    fn default() -> Self {
55        Self {
56            enable_sorting: true,
57            enable_multi_sort: true,
58            enable_filtering: true,
59            enable_global_filter: true,
60            enable_pagination: true,
61            enable_row_selection: true,
62            enable_expanding: true,
63            enable_column_visibility: true,
64            enable_column_ordering: true,
65            enable_column_pinning: true,
66            enable_column_resizing: true,
67            enable_grouping: true,
68            debug: false,
69        }
70    }
71}