DataGrid
Rows of an action with paging, sorting and filters.
Example
| Code | Name | Kind | Price | Stock |
|---|---|---|---|---|
| P-001 | Field notes 101 | Book | ₺91.69 | 37 |
| P-002 | Garden trowel 102 | Tool | ₺170.88 | 74 |
| P-003 | Fern 103 | Plant | ₺250.07 | 21 |
| P-004 | City atlas 104 | Book | ₺329.26 | 58 |
| P-005 | Hand saw 105 | Tool | ₺408.45 | 5 |
| P-006 | Olive tree 106 | Plant | ₺487.64 | 42 |
Show code
use crate::data::{Kind, Product, search_products};
use zeyn::prelude::*;
pub fn overview(_ctx: &Ctx) -> Node {
DataGrid::of(search_products)
.paging(Paging::pages(6))
.column(Product::code)
.width(100)
.column(Product::name)
.flex(1)
.filter()
.column(Product::kind)
.width(110)
.badge(|k| match k {
Kind::Book => Tone::Info,
Kind::Tool => Tone::Neutral,
Kind::Plant => Tone::Success,
})
.column(Product::price)
.width(130)
.column(Product::stock)
.width(130)
.progress(90)
.into()
}