pub struct GridOptions<T>where
T: ToJsValue,{ /* private fields */ }Expand description
An instance of an AG Grid GridOptions.
With this struct, users can specify the initial options for their grid,
before calling the GridOptions::build() method to receive an instance of
Grid. The various options are fully customisable using the builder
pattern, so you only need to specify what you need. The options mirror those
used in the AG Grid library.
Implementations§
Source§impl<T> GridOptions<T>where
T: ToJsValue,
impl<T> GridOptions<T>where
T: ToJsValue,
Sourcepub fn column_defs(self, value: Vec<ColumnDef>) -> Self
pub fn column_defs(self, value: Vec<ColumnDef>) -> Self
Set the column definitions. Fields set here take precedence over those
set in default_col_def.
Sourcepub fn default_col_def(self, value: ColumnDef) -> Self
pub fn default_col_def(self, value: ColumnDef) -> Self
Set the default column definition. Fields set here have lower precedence
than fields set on a per-column basis in column_defs.
Sourcepub fn maintain_column_order(self, value: bool) -> Self
pub fn maintain_column_order(self, value: bool) -> Self
Keeps the order of Columns maintained after new Column Definitions are updated.
Sourcepub fn suppress_dot_field_notation(self, value: bool) -> Self
pub fn suppress_dot_field_notation(self, value: bool) -> Self
If true, then dots in field names (e.g. ‘address.firstLine’) are not
treated as deep references. Allows you to use dots in your field name if
you prefer.
Sourcepub fn header_height(self, value: u32) -> Self
pub fn header_height(self, value: u32) -> Self
The height in pixels for the row containing the column label header. If
not specified, it uses the theme value of header-height.
Sourcepub fn group_header_height(self, value: u32) -> Self
pub fn group_header_height(self, value: u32) -> Self
The height in pixels for the rows containing header column groups. If
not specified, it uses GridOptions::header_height.
Sourcepub fn floating_filters_height(self, value: u32) -> Self
pub fn floating_filters_height(self, value: u32) -> Self
The height in pixels for the row containing the floating filters. If not
specified, it uses the theme value of header-height.
Sourcepub fn suppress_movable_columns(self, value: bool) -> Self
pub fn suppress_movable_columns(self, value: bool) -> Self
Set to true to suppress column moving, i.e. to make the columns fixed
position.
Sourcepub fn suppress_column_move_animation(self, value: bool) -> Self
pub fn suppress_column_move_animation(self, value: bool) -> Self
If true, the ag-column-moving class is not added to the grid while
columns are moving. In the default themes, this results in no animation
when moving columns.
Sourcepub fn suppress_drag_leave_hides_columns(self, value: bool) -> Self
pub fn suppress_drag_leave_hides_columns(self, value: bool) -> Self
If true, when you drag a column out of the grid (e.g. to the group
zone) the column is not hidden.
Sourcepub fn suppress_row_group_hides_columns(self, value: bool) -> Self
pub fn suppress_row_group_hides_columns(self, value: bool) -> Self
If true, when you drag a column into a row group panel the column is
not hidden.
Sourcepub fn col_resize_default(self, value: ResizeMethod) -> Self
pub fn col_resize_default(self, value: ResizeMethod) -> Self
Set to ‘Shift’ to have shift-resize as the default resize operation
(same as user holding down Shift while resizing).
Sourcepub fn suppress_auto_size(self, value: bool) -> Self
pub fn suppress_auto_size(self, value: bool) -> Self
Suppresses auto-sizing columns for columns. In other words, double clicking a column’s header’s edge will not auto-size.
Sourcepub fn auto_size_padding(self, value: u32) -> Self
pub fn auto_size_padding(self, value: u32) -> Self
Number of pixels to add to a column width after the auto-sizing calculation. Set this if you want to add extra room to accommodate (for example) sort icons, or some other dynamic nature of the header.
Sourcepub fn skip_header_on_auto_size(self, value: bool) -> Self
pub fn skip_header_on_auto_size(self, value: bool) -> Self
Set this to true to skip the header_name when auto_size is called
by default.
Sourcepub fn edit_type(self, value: EditType) -> Self
pub fn edit_type(self, value: EditType) -> Self
Set to ‘FullRow’ to enable Full Row Editing. Otherwise leave blank to edit one cell at a time.
Sourcepub fn single_click_edit(self, value: bool) -> Self
pub fn single_click_edit(self, value: bool) -> Self
Set to true to enable Single Click Editing for cells, to start editing
with a single click.
Sourcepub fn suppress_click_edit(self, value: bool) -> Self
pub fn suppress_click_edit(self, value: bool) -> Self
Set to true so that neither single nor double click starts editing.
Sourcepub fn stop_editing_when_cells_lose_focus(self, value: bool) -> Self
pub fn stop_editing_when_cells_lose_focus(self, value: bool) -> Self
Set to true to stop cell editing when grid loses focus. The default is
that the grid stays editing until focus goes onto another cell.
Sourcepub fn enter_moves_down(self, value: bool) -> Self
pub fn enter_moves_down(self, value: bool) -> Self
Set to true along with GridOptions::enter_moves_down_after_edit to
have Excel-style behaviour for the Enter key, i.e. pressing the
Enter key will move down to the cell beneath.
Sourcepub fn enter_moves_down_after_edit(self, value: bool) -> Self
pub fn enter_moves_down_after_edit(self, value: bool) -> Self
Set to true along with GridOptions::enter_moves_down to have
Excel-style behaviour for the Enter key, i.e. pressing the Enter key
will move down to the cell beneath.
Sourcepub fn undo_redo_cell_editing(self, value: bool) -> Self
pub fn undo_redo_cell_editing(self, value: bool) -> Self
Set to true to enable Undo / Redo while editing.
Sourcepub fn undo_redo_cell_editing_limit(self, value: u32) -> Self
pub fn undo_redo_cell_editing_limit(self, value: u32) -> Self
Set the size of the undo / redo stack.
Sourcepub fn read_only_edit(self, value: bool) -> Self
pub fn read_only_edit(self, value: bool) -> Self
Set to true to stop the grid updating data after and edit. When this
is set, it is intended the application will update the data, e.g. in an
external immutable store, and then pass the new dataset to the grid.
Sourcepub fn suppress_csv_export(self, value: bool) -> Self
pub fn suppress_csv_export(self, value: bool) -> Self
Prevent the user from exporting the grid to CSV.
Sourcepub fn suppress_excel_export(self, value: bool) -> Self
pub fn suppress_excel_export(self, value: bool) -> Self
Prevent the user from exporting the grid to Excel.
Sourcepub fn context(self, value: HashMap<String, String>) -> Self
pub fn context(self, value: HashMap<String, String>) -> Self
Provide a context object that is provided to different callbacks the grid uses. Used for passing additional information to the callbacks by your application.
Sourcepub fn tab_index(self, value: u32) -> Self
pub fn tab_index(self, value: u32) -> Self
Change this value to set the tabIndex order of the Grid within your application.
Sourcepub fn row_buffer(self, value: u32) -> Self
pub fn row_buffer(self, value: u32) -> Self
The number of rows rendered outside the viewable area the grid renders. Having a buffer means the grid will have rows ready to show as the user slowly scrolls vertically.
Sourcepub fn debug(self, value: bool) -> Self
pub fn debug(self, value: bool) -> Self
Set to true to enable debug information from the grid and related
components. Will result in additional logging being output, but very
useful when investigating problems.
Sourcepub fn pagination(self, value: bool) -> Self
pub fn pagination(self, value: bool) -> Self
Set whether pagination is enabled.
Sourcepub fn pagination_page_size(self, value: u32) -> Self
pub fn pagination_page_size(self, value: u32) -> Self
How many rows to load per page. If
GridOptions::pagination_auto_page_size is specified, this property
is ignored.
Sourcepub fn pagination_auto_page_size(self, value: bool) -> Self
pub fn pagination_auto_page_size(self, value: bool) -> Self
Set to true so that the number of rows to load per page is
automatically adjusted by the grid so each page shows enough rows to
just fill the area designated for the grid. If false,
[#GridOption::pagination_page_size`] is used.
Sourcepub fn paginate_child_rows(self, value: bool) -> Self
pub fn paginate_child_rows(self, value: bool) -> Self
Set to true to have pages split children of groups when using Row
Grouping or detail rows with Master Detail.
Sourcepub fn suppress_pagination_panel(self, value: bool) -> Self
pub fn suppress_pagination_panel(self, value: bool) -> Self
If true, the default grid controls for navigation are hidden. This is
useful if pagination=true and you want to provide your own pagination
controls. Otherwise, when pagination=true the grid automatically shows
the necessary controls at the bottom so that the user can navigate
through the different pages.
Sourcepub fn animate_rows(self, value: bool) -> Self
pub fn animate_rows(self, value: bool) -> Self
Set to true to enable Row Animation.
Sourcepub fn enable_cell_change_flash(self, value: bool) -> Self
pub fn enable_cell_change_flash(self, value: bool) -> Self
Set to true to have cells flash after data changes.
Sourcepub fn cell_flash_delay(self, value: u32) -> Self
pub fn cell_flash_delay(self, value: u32) -> Self
To be used in combination with
GridOptions::enable_cell_change_flash, this configuration
will set the delay in milliseconds of how long a cell should remain in
its “flashed” state.
Sourcepub fn cell_fade_delay(self, value: u32) -> Self
pub fn cell_fade_delay(self, value: u32) -> Self
To be used in combination with
GridOptions::enable_cell_change_flash, this configuration
will set the delay in milliseconds of how long the “flashed” state
animation takes to fade away after the timer set by
GridOptions::cell_flash_delay has completed.
Sourcepub fn allow_show_change_after_filter(self, value: bool) -> Self
pub fn allow_show_change_after_filter(self, value: bool) -> Self
Set to true to have cells flash after data changes even when the
change is due to filtering.
Sourcepub fn dom_layout(self, value: DomLayout) -> Self
pub fn dom_layout(self, value: DomLayout) -> Self
Switch between layout options.
Sourcepub fn ensure_dom_order(self, value: bool) -> Self
pub fn ensure_dom_order(self, value: bool) -> Self
When true, the order of rows and columns in the DOM are consistent
with what is on screen.
Sourcepub fn enable_rtl(self, value: bool) -> Self
pub fn enable_rtl(self, value: bool) -> Self
Set to true to operate the grid in RTL (Right to Left) mode.
Sourcepub fn suppress_column_virtualisation(self, value: bool) -> Self
pub fn suppress_column_virtualisation(self, value: bool) -> Self
Set to true so that the grid doesn’t virtualise the columns. For
example, if you have 100 columns, but only 10 visible due to scrolling,
all 100 will always be rendered.
Sourcepub fn suppress_row_virtualisation(self, value: bool) -> Self
pub fn suppress_row_virtualisation(self, value: bool) -> Self
Set to true so that the grid doesn’t virtualise the rows. For example,
if you have 100 rows, but only 10 visible due to scrolling, all 100 will
always be rendered.
Sourcepub fn suppress_max_rendered_row_restriction(self, value: bool) -> Self
pub fn suppress_max_rendered_row_restriction(self, value: bool) -> Self
By default the grid has a limit of rendering a maximum of 500 rows at
once (remember the grid only renders rows you can see, so unless your
display shows more than 500 rows without vertically scrolling this will
never be an issue). This is only relevant if you are manually setting
GridOptions::row_buffer to a high value (rendering more rows than
can be seen) or if your grid height is able to display more than 500
rows at once.
Sourcepub fn row_drag_managed(self, value: bool) -> Self
pub fn row_drag_managed(self, value: bool) -> Self
Set to true to enable Managed Row Dragging.
Sourcepub fn row_drag_entire_row(self, value: bool) -> Self
pub fn row_drag_entire_row(self, value: bool) -> Self
Set to true to enable clicking and dragging anywhere on the row
without the need for a drag handle.
Sourcepub fn row_drag_multi_row(self, value: bool) -> Self
pub fn row_drag_multi_row(self, value: bool) -> Self
Set to true to enable dragging multiple rows at the same time.
Sourcepub fn suppress_row_drag(self, value: bool) -> Self
pub fn suppress_row_drag(self, value: bool) -> Self
Set to true to suppress row dragging.
Sourcepub fn suppress_move_when_row_dragging(self, value: bool) -> Self
pub fn suppress_move_when_row_dragging(self, value: bool) -> Self
Set to true to suppress moving rows while dragging the row drag
waffle. This option highlights the position where the row will be
placed and it will only move the row on mouse up.
Sourcepub fn row_model_type(self, value: RowModelType) -> Self
pub fn row_model_type(self, value: RowModelType) -> Self
Sets the row model type.
pub fn datasource(self, value: DataSource) -> Self
Sourcepub fn cache_overflow_size(self, value: u32) -> Self
pub fn cache_overflow_size(self, value: u32) -> Self
How many extra blank rows to display to the user at the end of the dataset, which sets the vertical scroll and then allows the grid to request viewing more rows of data.
Sourcepub fn max_concurrent_datasource_requests(self, value: i32) -> Self
pub fn max_concurrent_datasource_requests(self, value: i32) -> Self
How many requests to hit the server with concurrently. If the max is
reached, requests are queued. Set to -1 for no maximum restriction on
requests.
Sourcepub fn cache_block_size(self, value: u32) -> Self
pub fn cache_block_size(self, value: u32) -> Self
How many rows for each block in the store, i.e. how many rows returned from the server at a time.
Sourcepub fn max_blocks_in_cache(self, value: u32) -> Self
pub fn max_blocks_in_cache(self, value: u32) -> Self
How many blocks to keep in the store. Default is no limit, so every requested block is kept. Use this if you have memory concerns, and blocks that were least recently viewed will be purged when the limit is hit. The grid will additionally make sure it has all the blocks needed to display what is currently visible, in case this property is set to a low value.
Sourcepub fn infinite_initial_row_count(self, value: u32) -> Self
pub fn infinite_initial_row_count(self, value: u32) -> Self
How many extra blank rows to display to the user at the end of the dataset, which sets the vertical scroll and then allows the grid to request viewing more rows of data.
Sourcepub fn always_show_horizontal_scroll(self, value: bool) -> Self
pub fn always_show_horizontal_scroll(self, value: bool) -> Self
Set to true to always show the horizontal scrollbar.
Sourcepub fn always_show_vertical_scroll(self, value: bool) -> Self
pub fn always_show_vertical_scroll(self, value: bool) -> Self
Set to true to always show the vertical scrollbar.
Sourcepub fn debounce_vertical_scrollbar(self, value: bool) -> Self
pub fn debounce_vertical_scrollbar(self, value: bool) -> Self
Set to true to debounce the vertical scrollbar. Can provide smoother
scrolling on slow machines.
Sourcepub fn suppress_horizontal_scrollbar(self, value: bool) -> Self
pub fn suppress_horizontal_scrollbar(self, value: bool) -> Self
Set to true to never show the horizontal scroll. This is useful if the
grid is aligned with another grid and will scroll when the other grid
scrolls. (Should not be used in combination with
GridOptions::always_show_horizontal_scroll.)
Sourcepub fn suppress_scroll_on_new_data(self, value: bool) -> Self
pub fn suppress_scroll_on_new_data(self, value: bool) -> Self
When true, the grid will not scroll to the top when new row data is
provided. Use this if you don’t want the default behaviour of scrolling
to the top every time you load new data.
Sourcepub fn suppress_scroll_when_popups_are_open(self, value: bool) -> Self
pub fn suppress_scroll_when_popups_are_open(self, value: bool) -> Self
When true, the grid will not allow mousewheel / touchpad scroll when
popup elements are present.
Sourcepub fn suppress_animation_frame(self, value: bool) -> Self
pub fn suppress_animation_frame(self, value: bool) -> Self
When true, the grid will not use animation frames when drawing rows
while scrolling. Use this if the grid is working fast enough that you
don’t need animation frames and you don’t want the grid to flicker.
Sourcepub fn suppress_middle_click_scrolls(self, value: bool) -> Self
pub fn suppress_middle_click_scrolls(self, value: bool) -> Self
When true, middle clicks will result in click events for cells and
rows. Otherwise the browser will use middle click to scroll the grid.
Note: Not all browsers fire click events with the middle button. Most
will fire only mousedown and mouseup events, which can be used to focus
a cell, but will not work to call the onCellClicked function.
Sourcepub fn suppress_prevent_default_on_mouse_wheel(self, value: bool) -> Self
pub fn suppress_prevent_default_on_mouse_wheel(self, value: bool) -> Self
When true, mouse wheel events will be passed to the browser. Useful if
your grid has no vertical scrolls and you want the mouse to scroll the
browser page.
Sourcepub fn scrollbar_width(self, value: u32) -> Self
pub fn scrollbar_width(self, value: u32) -> Self
Tell the grid how wide in pixels the scrollbar is, which is used in grid width calculations. Set only if using non-standard browser-provided scrollbars, so the grid can use the non-standard size in its calculations.
Sourcepub fn row_selection(self, value: RowSelection) -> Self
pub fn row_selection(self, value: RowSelection) -> Self
Type of row selection.
Sourcepub fn row_multi_select_with_click(self, value: bool) -> Self
pub fn row_multi_select_with_click(self, value: bool) -> Self
Set to true to allow multiple rows to be selected using single click.
Sourcepub fn suppress_row_deselection(self, value: bool) -> Self
pub fn suppress_row_deselection(self, value: bool) -> Self
If true, rows will not be deselected if you hold down Ctrl and click
the row or press Space.
Sourcepub fn suppress_row_click_selection(self, value: bool) -> Self
pub fn suppress_row_click_selection(self, value: bool) -> Self
If true, row selection won’t happen when rows are clicked. Use when
you only want checkbox selection.
Sourcepub fn suppress_cell_focus(self, value: bool) -> Self
pub fn suppress_cell_focus(self, value: bool) -> Self
If true, cells won’t be focusable. This means keyboard navigation will
be disabled for grid cells, but remain enabled in other elements of the
grid such as column headers, floating filters, tool panels.
Sourcepub fn enable_cell_text_selection(self, value: bool) -> Self
pub fn enable_cell_text_selection(self, value: bool) -> Self
Set to true to be able to select the text within cells. Note: When
this is set to true, the clipboard service is disabled.
Sourcepub fn sorting_order(self, value: Vec<SortMethod>) -> Self
pub fn sorting_order(self, value: Vec<SortMethod>) -> Self
Vector defining the order in which sorting occurs (if sorting is enabled).
Sourcepub fn accented_sort(self, value: bool) -> Self
pub fn accented_sort(self, value: bool) -> Self
Set to true to specify that the sort should take accented characters
into account. If this feature is turned on the sort will be slower.
Sourcepub fn unsort_icon(self, value: bool) -> Self
pub fn unsort_icon(self, value: bool) -> Self
Set to true to show the ‘no sort’ icon.
Sourcepub fn suppress_multi_sort(self, value: bool) -> Self
pub fn suppress_multi_sort(self, value: bool) -> Self
Set to true to suppress multi-sort when the user shift-clicks a column
header.
Sourcepub fn always_multi_sort(self, value: bool) -> Self
pub fn always_multi_sort(self, value: bool) -> Self
Set to true to always multi-sort when the user clicks a column header,
regardless of key presses.
Sourcepub fn multi_sort_key(self, value: MultiSortKey) -> Self
pub fn multi_sort_key(self, value: MultiSortKey) -> Self
Set to ‘Ctrl’ to have multi sorting work using the Ctrl (or Command ⌘ for Mac) key.
Sourcepub fn suppress_maintain_unsorted_order(self, value: bool) -> Self
pub fn suppress_maintain_unsorted_order(self, value: bool) -> Self
Set to true to suppress sorting of un-sorted data to match original
row data.
Sourcepub fn delta_sort(self, value: bool) -> Self
pub fn delta_sort(self, value: bool) -> Self
When enabled, sorts only the rows added/updated by a transaction.
Sourcepub fn row_height(self, value: u32) -> Self
pub fn row_height(self, value: u32) -> Self
Default row height in pixels.
Sourcepub fn row_class(self, value: impl AsRef<str>) -> Self
pub fn row_class(self, value: impl AsRef<str>) -> Self
CSS class(es) for all rows. Provide either a string (class name) or vector of strings (vector of class names).
Sourcepub fn row_class_array(self, value: Vec<impl AsRef<str>>) -> Self
pub fn row_class_array(self, value: Vec<impl AsRef<str>>) -> Self
CSS class(es) for all rows. Provide either a string (class name) or vector of strings (vector of class names).
Sourcepub fn suppress_row_hover_highlight(self, value: bool) -> Self
pub fn suppress_row_hover_highlight(self, value: bool) -> Self
Set to true to not highlight rows by adding the ag-row-hover CSS
class.
Sourcepub fn suppress_row_transform(self, value: bool) -> Self
pub fn suppress_row_transform(self, value: bool) -> Self
Uses CSS top instead of CSS transform for positioning rows. Useful
if the transform function is causing issues such as used in row spanning.
Sourcepub fn column_hover_highlight(self, value: bool) -> Self
pub fn column_hover_highlight(self, value: bool) -> Self
Set to true to highlight columns by adding the ag-column-hover CSS
class.
Sourcepub fn enable_browser_tooltips(self, value: bool) -> Self
pub fn enable_browser_tooltips(self, value: bool) -> Self
Set to true to use the browser’s default tooltip instead of using the
grid’s Tooltip Component.
Sourcepub fn tooltip_show_delay(self, value: u32) -> Self
pub fn tooltip_show_delay(self, value: u32) -> Self
The delay in milliseconds that it takes for tooltips to show up once an
element is hovered over. Note: This property does not work if
GridOptions::enable_browser_tooltips is true.
Sourcepub fn tooltip_hide_delay(self, value: u32) -> Self
pub fn tooltip_hide_delay(self, value: u32) -> Self
The delay in milliseconds that it takes for tooltips to hide once they
have been displayed. Note: This property does not work if
GridOptions::enable_browser_tooltips is true.
Sourcepub fn tooltip_mouse_track(self, value: bool) -> Self
pub fn tooltip_mouse_track(self, value: bool) -> Self
Set to true to have tooltips follow the cursor once they are
displayed.
Source§impl<T> GridOptions<T>where
T: ToJsValue,
impl<T> GridOptions<T>where
T: ToJsValue,
pub fn new() -> Self
Sourcepub fn build(self, div: HtmlElement) -> Grid
pub fn build(self, div: HtmlElement) -> Grid
A finaliser method for the GridOptions struct. This method
constructs the underlying JavaScript grid and returns a handle,
Grid, which provides access to the grid APIs.
Trait Implementations§
Source§impl<T> Default for GridOptions<T>where
T: ToJsValue,
impl<T> Default for GridOptions<T>where
T: ToJsValue,
Source§impl<T> ToJsValue for GridOptions<T>where
T: ToJsValue,
impl<T> ToJsValue for GridOptions<T>where
T: ToJsValue,
Source§fn to_js_value(&self) -> JsValue
fn to_js_value(&self) -> JsValue
wasm_bindgen::JsValue;