Sort arrow is in wrong column in reports
This commit is contained in:
parent
9f415ccbc5
commit
2c5422fdd5
|
|
@ -335,6 +335,7 @@ class AppDataTable extends StatelessWidget {
|
||||||
this.columnSpacing = 56.0,
|
this.columnSpacing = 56.0,
|
||||||
this.showCheckboxColumn = true,
|
this.showCheckboxColumn = true,
|
||||||
this.dividerThickness = 1.0,
|
this.dividerThickness = 1.0,
|
||||||
|
this.hasActionsColumn = false,
|
||||||
@required this.rows,
|
@required this.rows,
|
||||||
}) : assert(columns != null),
|
}) : assert(columns != null),
|
||||||
assert(columns.isNotEmpty),
|
assert(columns.isNotEmpty),
|
||||||
|
|
@ -437,6 +438,8 @@ class AppDataTable extends StatelessWidget {
|
||||||
// non-numeric, if there is exactly one, otherwise null.
|
// non-numeric, if there is exactly one, otherwise null.
|
||||||
final int _onlyTextColumn;
|
final int _onlyTextColumn;
|
||||||
|
|
||||||
|
final bool hasActionsColumn;
|
||||||
|
|
||||||
static int _initOnlyTextColumn(List<DataColumn> columns) {
|
static int _initOnlyTextColumn(List<DataColumn> columns) {
|
||||||
int result;
|
int result;
|
||||||
for (int index = 0; index < columns.length; index += 1) {
|
for (int index = 0; index < columns.length; index += 1) {
|
||||||
|
|
@ -757,7 +760,7 @@ class AppDataTable extends StatelessWidget {
|
||||||
sortColumnIndex != dataColumnIndex || !sortAscending)
|
sortColumnIndex != dataColumnIndex || !sortAscending)
|
||||||
: null,
|
: null,
|
||||||
// IGNORE SORTING ON FIRST COLUMN
|
// IGNORE SORTING ON FIRST COLUMN
|
||||||
sorted: displayCheckboxColumn
|
sorted: displayCheckboxColumn || !hasActionsColumn
|
||||||
? dataColumnIndex == sortColumnIndex
|
? dataColumnIndex == sortColumnIndex
|
||||||
: (dataColumnIndex - 1) == sortColumnIndex,
|
: (dataColumnIndex - 1) == sortColumnIndex,
|
||||||
ascending: sortAscending,
|
ascending: sortAscending,
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ class AppPaginatedDataTable extends StatefulWidget {
|
||||||
this.onPageChanged,
|
this.onPageChanged,
|
||||||
this.rowsPerPage = defaultRowsPerPage,
|
this.rowsPerPage = defaultRowsPerPage,
|
||||||
this.subtractOneFromCount = false,
|
this.subtractOneFromCount = false,
|
||||||
|
this.hasActionsColumn = false,
|
||||||
this.availableRowsPerPage = const <int>[
|
this.availableRowsPerPage = const <int>[
|
||||||
defaultRowsPerPage,
|
defaultRowsPerPage,
|
||||||
defaultRowsPerPage * 2,
|
defaultRowsPerPage * 2,
|
||||||
|
|
@ -216,6 +217,7 @@ class AppPaginatedDataTable extends StatefulWidget {
|
||||||
final DragStartBehavior dragStartBehavior;
|
final DragStartBehavior dragStartBehavior;
|
||||||
|
|
||||||
final bool subtractOneFromCount;
|
final bool subtractOneFromCount;
|
||||||
|
final bool hasActionsColumn;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AppPaginatedDataTableState createState() => AppPaginatedDataTableState();
|
AppPaginatedDataTableState createState() => AppPaginatedDataTableState();
|
||||||
|
|
@ -498,6 +500,7 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
|
||||||
columnSpacing: widget.columnSpacing,
|
columnSpacing: widget.columnSpacing,
|
||||||
showCheckboxColumn: widget.showCheckboxColumn,
|
showCheckboxColumn: widget.showCheckboxColumn,
|
||||||
rows: _getRows(_firstRowIndex, widget.rowsPerPage),
|
rows: _getRows(_firstRowIndex, widget.rowsPerPage),
|
||||||
|
hasActionsColumn: widget.hasActionsColumn,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,7 @@ class _EntityListState extends State<EntityList> {
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
child: AppPaginatedDataTable(
|
child: AppPaginatedDataTable(
|
||||||
|
hasActionsColumn: true,
|
||||||
onSelectAll: (value) {
|
onSelectAll: (value) {
|
||||||
final startIndex =
|
final startIndex =
|
||||||
min(_firstRowIndex, entityList.length - 1);
|
min(_firstRowIndex, entityList.length - 1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue