Hi all,
This is a somewhat exploratory question as to how I could go about implementing a behaviour that I have been requested to implement. Apologies for my hyper-verbosity below :-).
The short version:
How do I stop a filter being applied when the value in a cell changes to no longer match the filter?
The requested behaviour:
(For some context) - I am currently implementing a mechanism whereby a user can right click on an editable column in the datagrid and choose to apply the current value to all currently visible (given the filter conditions of the grid) cells of the same column via a context menu. I have managed to get this feature working (at least in an initial version) and am reasonably confident that I will be able to develop it into the foundation of my project.
< ... breathes in ... >
The issue I am having relates to the effect of applying a filter to the same column that I am editing, and as such is not directly related to the above functionality. When a filter is applied to a column, editing a value to one which no longer matches the filter specified causes the row of the grid to be hidden when the user looses focus from the cell. While this logically makes sense to me as a developer in that the filter descriptors and the displayed data remain consistent. To the user, it appears that the data they were just editing has just disappeared (maybe forever). The ensuing panicked call to the support desk is one thing that I am trying to avoid. Also the ability to change one of the values, then apply that value to all other visible cells of the same column (as mentioned above) without this action causing said rows to be removed from the list of visible rows.
This behaviour can be seen in something like Excel 2010, where a filter can be applied to one or more columns, however the filter is not updated when the values in the columns change, unless the user specifically re-applies said filter.
Considered Approaches:
Here are a couple of approaches that I have already considered:
Any suggestions or comments, particularly on how to implement point 4 (above) would be greatly appreciated.
Regards,
Mark
This is a somewhat exploratory question as to how I could go about implementing a behaviour that I have been requested to implement. Apologies for my hyper-verbosity below :-).
The short version:
How do I stop a filter being applied when the value in a cell changes to no longer match the filter?
The requested behaviour:
(For some context) - I am currently implementing a mechanism whereby a user can right click on an editable column in the datagrid and choose to apply the current value to all currently visible (given the filter conditions of the grid) cells of the same column via a context menu. I have managed to get this feature working (at least in an initial version) and am reasonably confident that I will be able to develop it into the foundation of my project.
< ... breathes in ... >
The issue I am having relates to the effect of applying a filter to the same column that I am editing, and as such is not directly related to the above functionality. When a filter is applied to a column, editing a value to one which no longer matches the filter specified causes the row of the grid to be hidden when the user looses focus from the cell. While this logically makes sense to me as a developer in that the filter descriptors and the displayed data remain consistent. To the user, it appears that the data they were just editing has just disappeared (maybe forever). The ensuing panicked call to the support desk is one thing that I am trying to avoid. Also the ability to change one of the values, then apply that value to all other visible cells of the same column (as mentioned above) without this action causing said rows to be removed from the list of visible rows.
This behaviour can be seen in something like Excel 2010, where a filter can be applied to one or more columns, however the filter is not updated when the values in the columns change, unless the user specifically re-applies said filter.
Considered Approaches:
Here are a couple of approaches that I have already considered:
- Prevent Filtering on affected columns: Possibly the easiest solution to this issue would be to prevent (disable) filtering on columns where the value can be set via a context menu option. However, the ability to filter these columns is a desirable feature of the application, I would rather not remove the functionality unless it is necessary.
- Disable the context menu if a filter is applied: This would be a bit better than the last option, in that it would allow both features, just not at the same time. The problem here is how to inform the user (in an unobtrusive manner) that the ability to set the value is disabled because they have applied some sort of filter to this column and that removing that filter will allow them to perform the update that they want to. The catch here is that the filter they applied will be restricting the results to those that they want to update, removing it will likely change that result set ... catch 22.
- Automatically include the updated value in the filter descriptors for that column: This is my current best candidate although it has some limitations. This option would ensure that the new value would not cause the column to be removed from the set of visible columns. However, including another value in the filter could have unforeseen consequences (for example if 90% of the rows had the value of "2" and the filter was set to include only items which are NOT equal to "2". Setting the remaining values to "2" would result in an invalid filter (all values = "2" AND != "2" ... none). That is a fairly simple example, but they could be infinitely more complicated). Alternatively, even if the resulting filter was valid, it could result in the inclusion of the other 90% of the data, resulting in the row that you were editing being lost in the sea of data and the user being "surprised" by the sudden unexpected flood of information (and we all know there is nothing more dangerous than a surprised user).
- Prevent the modification of a value from having the current filter applied: This approach most closely emulates Excel 2010. However I have a few issues with it. How would the user know that the results shown in the grid no longer match the specified filters? (Could be done by changing the filter icon, but that is blowing the scope of this change out a bit). Secondly, how would someone go about doing this? I have been thinking about how to achieve this for a couple of days with no joy.
Any suggestions or comments, particularly on how to implement point 4 (above) would be greatly appreciated.
Regards,
Mark