Wouldn’t it be great to be able to change history or how it’s perceived. I thought about it and came up with a plan. I’ve decided to modify the InputHistoryBCA component to accommodate my desire. Now in addition to deleting select entries it also allows the user to change the order in which they appear. It’s now possible to order by the text, add date, or last used date in ascending or descending order.
To accomplish persisting the history and the user’s sorting selections there is now a model consisting of the property to sort by, the sort direction, and the list of history options.
The model is saved to local storage with the key name equal to the UUID selected by the developer.
In the example above the StorageModel is saved in local storage with the key name “InputHistory”. Any key name can be used and each should be unique within the application unless you want to share the history and sort settings between multiple InputHistoryBCA components.
Here’s what the local storage looks like in the browser’s developer tools.
So now you too can change history with the InputHistoryBCA component. I hope you find this component useful or inspirational. Please let me know if you do or have any suggestions for improvement. Thanks for reading.