Filter Buttons and Functions Rework #75
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
A somewhat bigger pull request this time. Like I mentioned last time I wanted to do a rework of the filter functions, this led me to also rework the filter buttons.
Filter Buttons
splitk_filter_demo_720.mov
It somewhat comes down to personal preference but I found the radioButtons for the filter dropdown menu not that intuitive because of two main reasons:
For these two reason I opted for the
pickerInput
widget. With this widget all filter options are visible at a glance. When a filter is necessary this filter can be opened to show which options are available. A non active filter is equal to the All option as used previously. Because of the new buttons I had to also update the reset button, when updating this I tried to simplify this section by using a loop.If you have a nicer solution for aligning all filter buttons instead of using
<div>
's I'm happy to hear. It looks a bit more complicated than it has to be at the moment imo.In addition the number of rows and number of keys filters now also accept a minimum number instead of only a maximum.
Filter Function
The filter functions related to the filter buttons currently have a one to one relationship, so 1 function for every button. This looked a bit complicated to me, as most filter options tend to do similar things. There are three main categories of filter buttons currently: those relating to one variable in the dataset (e.g. wireless), those relating to multiple variables (e.g. switch type: mxCompatible, chocV1, chocV2) and the range filters which are always active.
With these three categories in mind I made three functions. One for each categories. Hopefully the comments help out with the logic. The main idea was to make a logical of the dataset for every active filter. This involves checking if the filters are active, making the logical vector and combing the logical vectors of all active filters in the end. In the end this leads to less functions which was better to oversee imo. Adding a new filter should also require less code.
New Features
Whilst working on the code I found some new features that could be nice to have.
Code Formatting/Management
A couple questions:
lintr
andstyler
to make sure all my formatting is consistent. I'd like to use that here as well but I know this is a lot of personal preference. What do you think about linting the code?That's it for this essay lol. If you have any comments/addition I'm happy to hear. Also the commit history is a bit of a mess because I tried squashing and merging things. When you merge this PR eventually squashing it would definitely be a good thing.