Refresh tables

This commit is contained in:
Hillel Coren 2020-03-10 17:06:40 +02:00
parent 23d7a63c6d
commit 2e68dcae1e
1 changed files with 41 additions and 32 deletions

View File

@ -132,38 +132,47 @@ class _EntityListState extends State<EntityList> {
)),
]);
} else {
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(12),
child: PaginatedDataTable(
onSelectAll: (value) {
final invoices = entityList
.map((String entityId) => entityMap[entityId])
.where(
(invoice) => value != listUIState.isSelected(invoice.id))
.toList();
handleEntitiesActions(
context, invoices, EntityAction.toggleMultiselect);
},
columns: [
if (!listUIState.isInMultiselect()) DataColumn(label: SizedBox()),
...widget.tableColumns.map((field) => DataColumn(
label: Text(AppLocalization.of(context).lookup(field)),
numeric: EntityPresenter.isFieldNumeric(field),
onSort: (int columnIndex, bool ascending) =>
widget.onSortColumn(field))),
],
source: dataTableSource,
header: DatatableHeader(
entityType: widget.entityType,
onClearPressed: widget.onClearEntityFilterPressed,
onRefreshPressed: () => widget.onRefreshed(context),
),
sortColumnIndex:
widget.tableColumns.indexOf(listUIState.sortField) + 1,
sortAscending: listUIState.sortAscending,
),
));
return Stack(
alignment: Alignment.topCenter,
children: <Widget>[
if (state.isLoading)
LinearProgressIndicator(),
SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(12),
child: PaginatedDataTable(
onSelectAll: (value) {
final invoices = entityList
.map((String entityId) => entityMap[entityId])
.where((invoice) =>
value != listUIState.isSelected(invoice.id))
.toList();
handleEntitiesActions(
context, invoices, EntityAction.toggleMultiselect);
},
columns: [
if (!listUIState.isInMultiselect())
DataColumn(label: SizedBox()),
...widget.tableColumns.map((field) => DataColumn(
label: Text(AppLocalization.of(context).lookup(field)),
numeric: EntityPresenter.isFieldNumeric(field),
onSort: (int columnIndex, bool ascending) =>
widget.onSortColumn(field))),
],
source: dataTableSource,
header: DatatableHeader(
entityType: widget.entityType,
onClearPressed: widget.onClearEntityFilterPressed,
onRefreshPressed: () => widget.onRefreshed(context),
),
sortColumnIndex:
widget.tableColumns.indexOf(listUIState.sortField) + 1,
sortAscending: listUIState.sortAscending,
),
),
)
],
);
}
};