Latest source merged from Syncfusion
This commit is contained in:
Родитель
5ec74a9d0a
Коммит
a3278edbcf
|
@ -287,7 +287,7 @@ class EmployeeDataSource extends DataGridSource {
|
|||
|
||||
### Styling alternate rows
|
||||
|
||||
The appearance of the alternating rows in `SfDataGrid` can be customized by using the `DataGridRowAdapter.color`.
|
||||
The appearance of the alternating rows in `SfDataGrid` can be customized by using the `DataGridRowAdapter.color`. Use the [effectiveRows]() property to get the index of the row. This collection contains the sorted collection if the sorting is applied.
|
||||
|
||||
{% tabs %}
|
||||
{% highlight Dart %}
|
||||
|
@ -316,7 +316,7 @@ class EmployeeDataSource extends DataGridSource {
|
|||
@override
|
||||
DataGridRowAdapter? buildRow(DataGridRow row) {
|
||||
Color getRowBackgroundColor() {
|
||||
final int index = dataGridRows.indexOf(row);
|
||||
final int index = effectiveRows.indexOf(row);
|
||||
if (index % 2 != 0) {
|
||||
return Colors.lightGreen[300]!;
|
||||
}
|
||||
|
|
|
@ -26,11 +26,12 @@ Widget build(BuildContext context) {
|
|||
allowSwiping: true,
|
||||
swipeMaxOffset: 100.0,
|
||||
source: employeeDataSource,
|
||||
startSwipeActionsBuilder: (BuildContext context, DataGridRow row) {
|
||||
startSwipeActionsBuilder:
|
||||
(BuildContext context, DataGridRow row, int rowIndex) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_employeeDataSource.dataGridRows.insert(
|
||||
_employeeDataSource.dataGridRows.indexOf(row),
|
||||
rowIndex,
|
||||
DataGridRow(cells: [
|
||||
DataGridCell(value: 1011, columnName: 'id'),
|
||||
DataGridCell(value: 'Tom Bass', columnName: 'name'),
|
||||
|
@ -47,11 +48,11 @@ Widget build(BuildContext context) {
|
|||
),
|
||||
);
|
||||
},
|
||||
endSwipeActionsBuilder: (BuildContext context, DataGridRow row) {
|
||||
endSwipeActionsBuilder:
|
||||
(BuildContext context, DataGridRow row, int rowIndex) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_employeeDataSource.dataGridRows.removeAt(
|
||||
_employeeDataSource.dataGridRows.indexOf(row));
|
||||
_employeeDataSource.dataGridRows.removeAt(rowIndex);
|
||||
_employeeDataSource.updateDataSource();
|
||||
},
|
||||
child: Container(
|
||||
|
@ -140,11 +141,11 @@ Widget build(BuildContext context) {
|
|||
allowSwiping: true,
|
||||
swipeMaxOffset: constraints.maxWidth,
|
||||
source: employeeDataSource,
|
||||
startSwipeActionsBuilder: (BuildContext context, DataGridRow row) {
|
||||
startSwipeActionsBuilder:
|
||||
(BuildContext context, DataGridRow row, int rowIndex) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_employeeDataSource.dataGridRows.removeAt(
|
||||
_employeeDataSource.dataGridRows.indexOf(row));
|
||||
_employeeDataSource.dataGridRows.removeAt(rowIndex);
|
||||
_employeeDataSource.updateDataSource();
|
||||
},
|
||||
child: Container(
|
||||
|
|
Загрузка…
Ссылка в новой задаче