-
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
[Feature] Filters on columns - add x clear button to filter textfield. #121
Comments
@slavap This can be done manualy by using this: (i create a PR: #125) PlutoColumn(
title: 'column1',
field: 'column1',
type: PlutoColumnType.text(),
filterSuffixIcon: Icon(Icons.clear),
onFilterSuffixTap:
(focusNode, controller, enabled, handleOnChanged, stateManager) {
controller.clear();
handleOnChanged(controller.text);
},
), |
@stan-at-work Thanks, but unfortunately not completely - this Clear button should be invisible if there is no text typed in the filter. |
... No i'm joking, i will try to come up; with something |
@slavap Hre you go: I updated the code to use a filterWidgetDelegate this is clearer to used in sthead of all the parameters in the plutoColumn. PlutoColumn(
title: 'column1',
field: 'column1',
type: PlutoColumnType.text(),
filterWidgetDelegate: PlutoFilterColumnWidgetDelegate.textField(
filterSuffixIcon: Builder(
builder: (context) {
return Icon(
Icons.info,
color: Theme.of(context).colorScheme.primary,
);
},
),
onFilterSuffixTap:
(focusNode, controller, enabled, handleOnChanged, stateManager) {
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: Text('Zakaaaayyy')));
},
filterHintText: 'Filter by column1',
filterHintTextColor: Colors.blue,
onClear: () {
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: Text('Clear')));
},
clearIcon: Builder(builder: (context) {
return Icon(
Icons.clear,
color: Theme.of(context).colorScheme.error,
);
}),
),
) If u just want the clear thing: onClear: () {
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: Text('Clear')));
},
clearIcon: Builder(builder: (context) {
return Icon(
Icons.clear,
color: Theme.of(context).colorScheme.error,
);
}),
), Bezig.met.opnemen.2024-12-17.162123.mp4 |
@stan-at-work thank you, but still I don't see desired behavior on your video :-) Something based on _textController.text.isNotEmpty And let's say we have filtering typed for Column1 and Column5 - and now none of them is focused, focus is on the grid. |
It will allow to remove the filter much quicker.
The text was updated successfully, but these errors were encountered: