Tables, search and ordering


The Problem

It is easy to think that all tables of information are the same and have the same needs, but as soon as you dive into the details, many needs emerge.

What to Show

Let's start with these two types of ways of getting records/rows/objects onto the user interface:

  1. You need to find and show a list of something out of tens of thousands in the database.
  2. You need to show records related to something you already have on screen.

Firstly, you need to use SQL (OCLps) to find only a subset of rows and load only these into memory.

Secondly, you might be able to load all into the server memory, but it's often too many rows to send all of them to the client.

Let's continue complicating the picture with search or filtering.

Search or Filter?

  • Search is when the user has written a search word.
  • Filter is when the user has selected a parameter to filter on - when the context suggests it or when a reduction is needed to make the result set manageable.

Ordering

Ordering is separate from searching and filtering. Ordering is obviously the order you present the rows found when searching or looking at something from a given context.

But, ordering complicates search when you work with only a partial result loaded into memory.

For example, let's say you have searched for "Adam" in a customer database. There are over 1000 "Adams" in the database, but we only load 100 and display them on the screen. Most likely you have ordered the persons on the screen in order after the First name.

What needs to happen when the user wants to sort the table on the screen in Last name order?

Your first thought might be: Just sort the rows on the screen in the web browser.

That won't be correct, because there is only 10% of the available person rows available and they don't represent the first rows if you were to look at the last names of all rows.

By asking for a different Sorting, the Search needs to be rerun in the database.

Combinations of Search/Filter and Ordering

  1. Search with OclPS requires rerunning the query if you show only a partial result set.
  2. Showing a list of things based on an existing context.
    • If all rows are sent to the client and shown in one list, ordering client-side works.
    • If pagination or filtering is done serverside, ordering needs to also be done serverside, otherwise, the client will not be sorting the correct set of rows.

Turnkey includes logic for ordering/sorting rows using AngularJS without any additional work.

More reading:

This page was edited 22 days ago on 10/22/2024. What links here