ag_grid_rs/
sort.rs

1//! Types pertaining to grid sorting.
2
3use ag_grid_derive::FromInterface;
4use wasm_bindgen::prelude::*;
5
6#[wasm_bindgen]
7extern "C" {
8    pub(crate) type ISortModelItem;
9
10    #[wasm_bindgen(method, getter, js_name = colId)]
11    fn col_id(this: &ISortModelItem) -> String;
12
13    #[wasm_bindgen(method, getter)]
14    fn sort(this: &ISortModelItem) -> SortDirection;
15}
16
17/// Details of how to sort the requested data.
18#[derive(Debug, FromInterface)]
19pub struct SortModelItem {
20    /// Which column to sort.
21    pub col_id: String,
22    /// How the column should be sorted.
23    pub sort: SortDirection,
24}
25
26/// Possible directions for which to sort data.
27#[wasm_bindgen]
28#[derive(Debug)]
29pub enum SortDirection {
30    Asc = "asc",
31    Desc = "desc",
32}