pub trait PaginatedTableDataProvider<Row, Err: Debug = String> {
const PAGE_ROW_COUNT: usize;
// Required method
fn get_page<'life0, 'async_trait>(
&'life0 self,
page_index: usize
) -> Pin<Box<dyn Future<Output = Result<Vec<Row>, Err>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn row_count<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<usize>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn page_count<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<usize>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn set_sorting(&mut self, sorting: &VecDeque<(usize, ColumnSort)>) { ... }
}
Expand description
A paginated data source. This is meant to provide a more convenient way
of connecting to a paginated data source instead of implementing TableDataProvider
directly.
If you implement this for your struct, TableDataProvider
is automatically implemented for you.
Please note that this is independent from using [
DisplayStrategy::Pagination
] with [TableContent
]. You do not have implement this trait if you’re using pagination and you vice versa if you’re not using pagination you can still implement this trait. And in case if you use this trait together with pagination the display row count can be different from thePAGE_ROW_COUNT
.
Required Associated Constants§
sourceconst PAGE_ROW_COUNT: usize
const PAGE_ROW_COUNT: usize
How many rows per page
Required Methods§
sourcefn get_page<'life0, 'async_trait>(
&'life0 self,
page_index: usize
) -> Pin<Box<dyn Future<Output = Result<Vec<Row>, Err>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_page<'life0, 'async_trait>(
&'life0 self,
page_index: usize
) -> Pin<Box<dyn Future<Output = Result<Vec<Row>, Err>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all data rows for the table specified by the page index (starts a 0).
If you return less than PAGE_ROW_COUNT
rows, it is assumed that the end of the
data has been reached.
Provided Methods§
sourcefn row_count<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<usize>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn row_count<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<usize>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The total number of rows in the table. Returns None
if unknown (which is the default).
By default this is computed from the [page_count
] method. But if your data source
tells you the number of rows instead of the number of pages you should override this method.
sourcefn page_count<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<usize>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn page_count<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<usize>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The total number of pages in the data source. Returns None
if unknown (which is the default).
If your data source gives you the number of rows instead of the number of pages
you should implement [row_count
] instead of this method.
sourcefn set_sorting(&mut self, sorting: &VecDeque<(usize, ColumnSort)>)
fn set_sorting(&mut self, sorting: &VecDeque<(usize, ColumnSort)>)
Same as TableDataProvider::set_sorting