I have a stream of real-time events coming in. I am developing a front-end to display this stream to a user so that:
- User will be able to search using one of the attributes present in the data
- User will be able to sort the data
Each event in the stream has a state associated with it which can be changed at any point so I keep querying the server for the last x minutes worth of data and change the state accordingly on the client-side.
My first attempt was using pagination. However, this has been giving rise to the following problems:
- When the user is viewing say, the 15th page and a new event gets added, I need to remember the current page the user is at and make sure that does not change. Even if the newly added data does not push things too much, it will affect the position of the event in the list and hence the user has to search where the previous event has moved to.
- When the user sorts by some particular attribute, I need to re-sort the incoming data and display it. I still face the same problem as above.
Is there a design pattern for this interaction? Twitter uses infinite scrolling. This pattern is awesome but I am not quite sure how to adapt it to situations:
- Where the user can sort the data.
- Where I am using a back-end database to provide data to the front-end. How should the pagination queries be designed?
Any suggestions?