GridOptions

Struct GridOptions 

Source
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,

Source

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.

Source

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.

Source

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

Keeps the order of Columns maintained after new Column Definitions are updated.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Set to true to suppress column moving, i.e. to make the columns fixed position.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Set to true so that neither single nor double click starts editing.

Source

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.

Source

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.

Source

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.

Source

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

Set to true to enable Undo / Redo while editing.

Source

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

Set the size of the undo / redo stack.

Source

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.

Source

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

Prevent the user from exporting the grid to CSV.

Source

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

Prevent the user from exporting the grid to Excel.

Source

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.

Source

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

Change this value to set the tabIndex order of the Grid within your application.

Source

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.

Source

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.

Source

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

Set whether pagination is enabled.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Set to true to enable Row Animation.

Source

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

Set to true to have cells flash after data changes.

Source

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.

Source

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.

Source

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.

Source

pub fn dom_layout(self, value: DomLayout) -> Self

Switch between layout options.

Source

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.

Source

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

Set to true to operate the grid in RTL (Right to Left) mode.

Source

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.

Source

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.

Source

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.

Source

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

Set to true to enable Managed Row Dragging.

Source

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.

Source

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

Set to true to enable dragging multiple rows at the same time.

Source

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

Set to true to suppress row dragging.

Source

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.

Source

pub fn row_model_type(self, value: RowModelType) -> Self

Sets the row model type.

Source

pub fn row_data(self, value: Vec<T>) -> Self

Set the row data.

Source

pub fn datasource(self, value: DataSource) -> Self

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Set to true to always show the horizontal scrollbar.

Source

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

Set to true to always show the vertical scrollbar.

Source

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

Set to true to debounce the vertical scrollbar. Can provide smoother scrolling on slow machines.

Source

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.)

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn row_selection(self, value: RowSelection) -> Self

Type of row selection.

Source

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

Set to true to allow multiple rows to be selected using single click.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Vector defining the order in which sorting occurs (if sorting is enabled).

Source

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.

Source

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

Set to true to show the ‘no sort’ icon.

Source

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

Set to true to suppress multi-sort when the user shift-clicks a column header.

Source

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.

Source

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.

Source

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.

Source

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

When enabled, sorts only the rows added/updated by a transaction.

Source

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

Default row height in pixels.

Source

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).

Source

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).

Source

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.

Source

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.

Source

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

Set to true to highlight columns by adding the ag-column-hover CSS class.

Source

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.

Source

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.

Source

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.

Source

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,

Source

pub fn new() -> Self

Source

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,

Source§

fn default() -> Self

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

impl<T> ToJsValue for GridOptions<T>
where T: ToJsValue,

Source§

fn to_js_value(&self) -> JsValue

Convert the current type to a wasm_bindgen::JsValue;

Auto Trait Implementations§

§

impl<T> Freeze for GridOptions<T>

§

impl<T> !RefUnwindSafe for GridOptions<T>

§

impl<T> !Send for GridOptions<T>

§

impl<T> !Sync for GridOptions<T>

§

impl<T> Unpin for GridOptions<T>
where T: Unpin,

§

impl<T> !UnwindSafe for GridOptions<T>

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.