mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
check if row in the table checked
This commit is contained in:
@ -13,6 +13,7 @@ class DynamicTable extends StatefulWidget {
|
||||
final bool isEmpty;
|
||||
final void Function(bool?)? selectAll;
|
||||
final void Function(int, bool?)? onRowCheckboxChanged;
|
||||
final List<String>? initialSelectedIds;
|
||||
|
||||
const DynamicTable({
|
||||
super.key,
|
||||
@ -25,6 +26,7 @@ class DynamicTable extends StatefulWidget {
|
||||
this.cellDecoration,
|
||||
this.selectAll,
|
||||
this.onRowCheckboxChanged,
|
||||
this.initialSelectedIds,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -38,7 +40,11 @@ class _DynamicTableState extends State<DynamicTable> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selected = List<bool>.filled(widget.data.length, false);
|
||||
_selected = List<bool>.generate(widget.data.length, (index) {
|
||||
return widget.initialSelectedIds != null &&
|
||||
widget.initialSelectedIds!.contains(widget.data[index][1]);
|
||||
});
|
||||
_selectAll = _selected.every((element) => element == true);
|
||||
}
|
||||
|
||||
void _toggleSelectAll(bool? value) {
|
||||
|
Reference in New Issue
Block a user