pub struct ImageColumn<M, T> { /* private fields */ }Expand description
A column of a String field holding an uploaded image’s path, rendered as a thumbnail.
tablo_core::ImageColumn::new(tablo_core::lens!(Product.image)).circular();A rooted path, such as an upload’s, shows as a 40px square thumbnail; an empty value shows
the table’s dash, and any other value its text. An absolute http(s) URL shows as an image
only once remote allows it.
Implementations§
Source§impl<M, T> ImageColumn<M, T>where
M: Model,
impl<M, T> ImageColumn<M, T>where
M: Model,
Sourcepub fn new(lens: Lens<M, T>) -> Self
pub fn new(lens: Lens<M, T>) -> Self
Bind the column to the String or Option<String> field lens reads.
Sourcepub fn remote(self) -> Self
pub fn remote(self) -> Self
Also show an absolute http(s) URL as an image. Every browser that renders the table
then loads it from that host as the page opens, so whoever can write the field learns who
views the list, and when: allow it for a field only trusted users write.
Sourcepub fn label(self, label: impl Into<Text>) -> Self
pub fn label(self, label: impl Into<Text>) -> Self
Replace the label the field’s name gives it.
Sourcepub fn width(self, width: ColumnWidth) -> Self
pub fn width(self, width: ColumnWidth) -> Self
Declare this column’s width.
Sourcepub fn toggleable(self) -> Self
pub fn toggleable(self) -> Self
Let each reader hide this column from their list; it starts shown.
Let each reader show this column in their list; it starts hidden.
Trait Implementations§
Source§impl<M, T> Clone for ImageColumn<M, T>
impl<M, T> Clone for ImageColumn<M, T>
Source§impl<M, T> Column<M> for ImageColumn<M, T>
impl<M, T> Column<M> for ImageColumn<M, T>
Source§fn column_width(&self) -> ColumnWidth
fn column_width(&self) -> ColumnWidth
Source§fn toggle(&self) -> ColumnToggle
fn toggle(&self) -> ColumnToggle
Source§fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
term adds, or None when the column does not join the table’s
search. A column that joins it answers Some for every non-empty, trimmed term.