Last updated:
0 purchases
serverside datatable
Serverside Datatable that handle the pagination for you. All you need to do is implement the ServersideRepository class
which define your fetch implementation.
Features #
Pagination
Filter is not supported yet.
Getting started #
Usage #
Create a class that extends ServersideRepository.
Create PODO (Plain Old Dart Object) class.
class FooBar {
double foo;
double bar;
FooBar(this.foo, this.bar);
}
class FooBarRepository extends ServerSideRepository<FooBar> {
@override
Future<ServerSideResponse<FooBar>> fetchData(int offset, int limit) async {
final fooBars = [
FooBar(5, 5),
FooBar(1, 3),
FooBar(2, 4),
FooBar(8, 9),
];
final totalRecords = fooBars.length;
if (offset + limit > totalRecords) limit = totalRecords;
return ServerSideResponse(fooBars.getRange(offset, limit), totalRecords);
}
}
ServerSideDataTable<FooBar>(
repository: FooBarRepository(),
columns: [
ServerSideColumn(
header: "Foo",
field: "foo",
renderer: (FooBar rowData) => Text(rowData.foo),
),
ServerSideColumn(
header: "Bar",
field: "bar",
renderer: (FooBar rowData) => Text(rowData.bar),
),
],
)
copied to clipboard
Additional information #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.