-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] When changing filters programatically only the last filter is applied #105
Comments
@TimoSchmuck I'l check it out |
@TimoSchmuck I fixed the bug The issue was that the PlutoGridEventType.debounce was blocking your second event.I’ve made it configurable, and the default is now set to PlutoGridEventType.normal, which means no transformer is blocking your events. I’ve also updated all other references that were using PlutoGridEventType.debounce to ensure no side effects occur as a result of this change.. You can test it with this code (AFTER MY PR IS MERGED)import 'package:flutter/material.dart';
import 'package:pluto_grid_plus/pluto_grid_plus.dart';
class EmptyScreen extends StatefulWidget {
static const routeName = 'empty';
const EmptyScreen({super.key});
@override
_EmptyScreenState createState() => _EmptyScreenState();
}
class _EmptyScreenState extends State<EmptyScreen> {
late List<PlutoColumn> columns;
late List<PlutoRow> rows;
late PlutoGridStateManager stateManager;
@override
void initState() {
super.initState();
columns = [
PlutoColumn(
title: 'column1',
field: 'column1',
type: PlutoColumnType.text(),
),
PlutoColumn(
title: 'column2',
field: 'column2',
type: PlutoColumnType.text(),
),
PlutoColumn(
title: 'column3',
field: 'column3',
type: PlutoColumnType.text(),
),
];
rows = [
for (int i = 1; i <= columns.length; i++)
PlutoRow(
cells: {
'column1': PlutoCell(value: 'column${i + 1}'),
'column2': PlutoCell(value: 'column${i + 2}'),
'column3': PlutoCell(value: 'column${i + 3}'),
},
),
];
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
actions: [
TextButton.icon(
label: Text('Clear filter'),
onPressed: () {
stateManager.eventManager!.addEvent(
PlutoGridClearColumnsFilterEvent(columns: columns),
);
},
icon: Icon(Icons.clear),
),
TextButton.icon(
label: Text('Set filter'),
onPressed: () {
stateManager.eventManager!.addEvent(
PlutoGridChangeColumnFilterEvent(
column: columns[1],
filterType: const PlutoFilterTypeContains(),
filterValue: 'column3',
),
);
stateManager.eventManager!.addEvent(
PlutoGridChangeColumnFilterEvent(
column: columns[0],
filterType: const PlutoFilterTypeContains(),
filterValue: 'column2',
),
);
},
icon: Icon(Icons.add),
)
],
),
body: SafeArea(
child: Container(
padding: const EdgeInsets.all(15),
child: PlutoGrid(
columns: columns,
rows: rows,
onChanged: (PlutoGridOnChangedEvent event) {
print(event);
},
onLoaded: (PlutoGridOnLoadedEvent event) {
stateManager = event.stateManager;
},
),
),
),
);
}
} |
Hi, thank you for your quick response. I will check it out as soon as the new version is going live! |
This issue is stale because it has been open for 30 days with no activity. |
@doonfrs Could you close this ? |
I want to set more than one filter programatically. For one filter it is working as expected, but not for more. Only the last filter is applied.
Steps to reproduce the bug:
Have two columns in PlutoGrid and then changing two filters at the same time via the eventManager is not working.
Execution Environment
PlutoGrid version
pluto_grid_plus: ^8.4.3
OS
web
The text was updated successfully, but these errors were encountered: