Hi!
We have a few very narrow bool columns (representing for example "Is favorite"). We have been discussing how to do sorting/filtering in a good way here and would like to get some input as to what is possible.
For us the funnel icon (to filter) takes too much space, and is also the popup is too verbose. Rather we would like to click to filter, similair to how sorting works. Would this be possible? Or is there another preferred way?
What we think we would like is:
It works quite well but has two drawbacks:
We have a few very narrow bool columns (representing for example "Is favorite"). We have been discussing how to do sorting/filtering in a good way here and would like to get some input as to what is possible.
For us the funnel icon (to filter) takes too much space, and is also the popup is too verbose. Rather we would like to click to filter, similair to how sorting works. Would this be possible? Or is there another preferred way?
What we think we would like is:
- Sorting turned off for the bool column, filtering turned on, but without the funnel icon (or exchange it for a custom icon?) - all items shown
- User clicks header - only favorite items are shown
- User clicks header again - only non-favorite items are shown
- User clicks header once more - all items are shown
- During step 1-4 the selected grid sort order is maintained.
We got a demo working by doing something like (after setting .Filterable(false).Sortable(true) on the column):
public
ActionResult _Items([DataSourceRequest]DataSourceRequest request)
{
var favSort = request.Sorts.FirstOrDefault(s => s.Member ==
"IsFavorite"
);
if
(favSort !=
null
)
{
request.Sorts.RemoveAt(request.Sorts.IndexOf(favSort));
request.Filters.Add(
new
FilterDescriptor(
"IsFavorite"
, FilterOperator.IsEqualTo, favSort.SortDirection == ListSortDirection.Ascending));
}
//...
}
It works quite well but has two drawbacks:
- The previously selected sort order is lost
- The visual clue that only favorites / non-favorites are shown is the "up/down" arrow normally showing sort order, which is a little bit confusing. For specifically the favorite column something like "All results => dimmed star", "Only favorites => filled star", Only non-favorites => hollow star" would probably be best, but we dont know how to achieve this.
Any thoughts on how to implement any of this?
Thanks!
/Victor