ColumnDef

Struct ColumnDef 

Source
pub struct ColumnDef { /* private fields */ }
Expand description

A customisable struct for defining a column.

Implementations§

Source§

impl ColumnDef

Source

pub fn col_id(self, value: impl AsRef<str>) -> Self

The unique ID to give the column. This is optional. If missing, the ID will default to the field. If both field and colId are missing, a unique ID will be generated. This ID is used to identify the column in the API for sorting, filtering etc.

Source

pub fn type_(self, value: impl AsRef<str>) -> Self

A comma separated string or if using the ColumnDef::type_array method, a vector of strings containing ColumnType keys which can be used as a template for a column. This helps to reduce duplication of properties when you have a lot of common column properties.

Source

pub fn type_array(self, value: Vec<impl AsRef<str>>) -> Self

A comma separated string or if using the ColumnDef::type_array method, a vector of strings containing ColumnType keys which can be used as a template for a column. This helps to reduce duplication of properties when you have a lot of common column properties.

Source

pub fn value_getter(self, value: impl AsRef<str>) -> Self

A function or expression that gets the value to be displayed from your data.

Source

pub fn value_formatter(self, value: impl AsRef<str>) -> Self

A function or an expression to format a value. Not used for CSV export or copy to clipboard; only for UI cell rendering.

Source

pub fn show_disabled_checkboxes(self, value: bool) -> Self

Provide a reference data map to be used to map column values to their respective value from the map. Set to true to display a disabled checkbox when row is not selectable and checkboxes are enabled.

Source

pub fn hide(self, value: bool) -> Self

Set to true for this column to be hidden.

Source

pub fn initial_hide(self, value: bool) -> Self

Same as ColumnDef::hide, except only applied when creating a new column. Not applied when updating column definitions.

Source

pub fn lock_visible(self, value: bool) -> Self

Set to true to block making column visible/hidden via the UI (API will still work).

Source

pub fn lock_position(self, value: LockPosition) -> Self

Lock a column to position to Left or Right to always have this column displayed in that position. True is treated as Left.

Source

pub fn suppress_movable(self, value: bool) -> Self

Set to true if you do not want this column to be movable via dragging.

Source

pub fn editable(self, value: bool) -> Self

Set to true if this column is editable.

Source

pub fn cell_editor_popup(self, value: bool) -> Self

Set to true to have the cell editor appear in a popup.

Source

pub fn cell_editor_popup_position(self, value: PopupPosition) -> Self

Set the position for the popup cell editor. Possible values are Over, whereby the popup will be positioned over the cell, or Under, whereby the popup will be positioned below the cell leaving the cell value visible.

Source

pub fn single_click_edit(self, value: bool) -> Self

Set to true to have cells under this column enter edit mode after single click.

Source

pub fn filter(self, value: Filter) -> Self

Set whether the column is filterable, or use one of the provided filters.

Source

pub fn floating_filter(self, value: bool) -> Self

Whether to display a floating filter for this column.

Source

pub fn header_name(self, value: impl AsRef<str>) -> Self

The name to render in the column header. If not specified and field is specified, the field name will be used as the header name.

Source

pub fn header_value_getter( self, value: impl FnMut(HeaderValueGetterParams) -> String + 'static, ) -> Self

Get the value for display in the header.

Source

pub fn header_tooltip(self, value: impl AsRef<str>) -> Self

Tooltip for the column header.

Source

pub fn header_class(self, value: impl AsRef<str>) -> Self

CSS class to use for the header cell. Can be a string or, if using the header_class_array method, a vector of strings.

Source

pub fn header_class_array(self, value: Vec<impl AsRef<str>>) -> Self

CSS class to use for the header cell. Can be a string or, if using the header_class_array method, a vector of strings.

Source

pub fn wrap_header_text(self, value: bool) -> Self

Set to true to wrap long header names onto the next line.

Source

pub fn auto_header_height(self, value: bool) -> Self

Set to true to enable the header row to automatically adjust its height to accommodate the size of the header cell.

Source

pub fn menu_tabs(self, value: Vec<MenuTab>) -> Self

Select which menu tabs are present, and in what order they are shown.

Source

pub fn suppress_menu(self, value: bool) -> Self

Set to true to disable showing the menu for this column header.

Source

pub fn header_checkbox_selection(self, value: bool) -> Self

If true, a ‘select all’ checkbox will be put into the header.

Source

pub fn header_checkbox_selection_filtered_only(self, value: bool) -> Self

If true, the header checkbox selection will only select filtered items.

Source

pub fn pinned(self, value: PinnedPosition) -> Self

Pin a column to one side: right or left. A value of True is converted to Left.

Source

pub fn initial_pinned(self, value: PinnedPosition) -> Self

Same as ColumnDef::pinned, except only applied when creating a new column. Not applied when updating column definitions.

Source

pub fn lock_pinned(self, value: bool) -> Self

Set to true to block the user pinning the column, the column can only be pinned via definitions or API.

Source

pub fn auto_height(self, value: bool) -> Self

Set to true to have the grid calculate the height of a row based on contents of this column.

Source

pub fn wrap_text(self, value: bool) -> Self

Set to true to have the text wrap inside the cell - typically used with ColumnDef::auto_height.

Source

pub fn enable_cell_change_flash(self, value: bool) -> Self

Set to true to flash a cell when it’s refreshed.

Source

pub fn suppress_cell_flash(self, value: bool) -> Self

Set to true to prevent this column from flashing on changes. Only applicable if cell flashing is turned on for the grid.

Source

pub fn row_drag(self, value: bool) -> Self

Set to true to allow row dragging.

Source

pub fn dnd_source(self, value: bool) -> Self

Set to true to allow dragging for native drag and drop.

Source

pub fn sortable(self, value: bool) -> Self

Set wether the column is sortable.

Source

pub fn sort(self, value: SortMethod) -> Self

Set the default sorting method.

Source

pub fn initial_sort(self, value: SortMethod) -> Self

The same as ColumnDef::sort, except only applied when creating a new column. Not applied when updating column definitions.

Source

pub fn sort_index(self, value: Option<u32>) -> Self

If sorting more than one column by default, specifies order in which the sorting should be applied.

Source

pub fn sorting_order(self, value: Vec<SortMethod>) -> Self

Vector defining the order in which sorting occurs (if sorting is enabled). Expects a vector of any permutation of the SortMethod variants.

Source

pub fn unsort_icon(self, value: bool) -> Self

Set to true if you want the unsorted icon to be shown when no sort is applied to this column.

Source

pub fn col_span(self, value: u32) -> Self

Set the span of the column.

Source

pub fn row_span(self, value: u32) -> Self

Set the span of the row.

Source

pub fn tooltip_field(self, value: impl AsRef<str>) -> Self

The field of the tooltip to apply to the cell.

Source

pub fn width(self, value: u32) -> Self

Initial width in pixels for the cell.

Source

pub fn initial_width(self, value: u32) -> Self

The same as ColumnDef::width, except only applied when creating a new column. Not applied when updating column definitions.

Source

pub fn min_width(self, value: u32) -> Self

Minimum width in pixels for the cell.

Source

pub fn max_width(self, value: u32) -> Self

Maxmum width in pixels for the cell.

Source

pub fn flex(self, value: u32) -> Self

Used instead of width when the goal is to fill the remaining empty space of the grid.

Source

pub fn initial_flex(self, value: u32) -> Self

The same as ColumnDef::flex, except only applied when creating a new column. Not applied when updating column definitions.

Source

pub fn resizable(self, value: bool) -> Self

Set to true to allow this column to be resized.

Source

pub fn suppress_size_to_fit(self, value: bool) -> Self

Set to true if you want this column’s width to be fixed during ‘size to fit’ operations.

Source

pub fn suppress_auto_size(self, value: bool) -> Self

Set to true if you do not want this column to be auto-resizable by double clicking it’s edge.

Source§

impl ColumnDef

Source

pub fn new<S: AsRef<str>>(field: S) -> Self

Create a new column definition, specifying the field of the row object to get the cell’s data from. Deep references into a row object is supported via dot notation, i.e ‘address.firstLine’.

Trait Implementations§

Source§

impl Default for ColumnDef

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ToJsValue for ColumnDef

Source§

fn to_js_value(&self) -> JsValue

Convert the current type to a wasm_bindgen::JsValue;

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.