pub struct Detail<M> { /* private fields */ }Expand description
The declaration of a detail page: Columns, the same ones a Table lists,
arranged in Section, Group, Grid and Tabs blocks.
use tablo_core::{BooleanColumn, Detail, RelationColumn, Section, TextColumn, lens, relation};
Detail::new(Section::new("Post").columns((
TextColumn::new(lens!(Post.title)),
BooleanColumn::new(lens!(Post.featured)),
RelationColumn::unscoped(relation!(Post.author), |a: &Author| a.name.clone()),
)));The detail page loads the relations its columns declare (Column::includes) and renders each
column’s entry for the record.
Implementations§
Source§impl<M> Detail<M>
impl<M> Detail<M>
Sourcepub fn new(children: impl IntoDetail<M>) -> Self
pub fn new(children: impl IntoDetail<M>) -> Self
Declare a detail page of children: columns and blocks of them.
Sourcepub fn column(self, column: impl Column<M> + 'static) -> Self
pub fn column(self, column: impl Column<M> + 'static) -> Self
Append column after the declared columns and blocks.
Sourcepub async fn load(&self, cx: &Cx, query: Query<List<M>>) -> Result<Vec<M>>
pub async fn load(&self, cx: &Cx, query: Query<List<M>>) -> Result<Vec<M>>
Load the records query names as a page rendering this declaration reads them: with every
relation the columns declare, once each, and the related records the columns’ sources show
the user checked, so render shows only those. Pass the resource’s scope,
as in detail.load(cx, scoped_query::<R>(cx)?).
§Errors
A source’s scope refusing the request, or a database failure.
Sourcepub fn declaration_errors(&self) -> Vec<DeclarationErrorKind>
pub fn declaration_errors(&self) -> Vec<DeclarationErrorKind>
What is wrong with this declaration: each column whose path binds no single field.