We offer a web service that has some entries that are people and some entries that are companies. We currently list them in the same column, but we have gotten some requests for the ability to search on last name rather than on first name. The same user actions are performed on companies and people - so currently we have them together in the same table and column. The primary function of this table currently is to allow users to search for a person or company, edit it, or add a new one.enter image description here

Any suggestions about a good way to do this? Here are some different methods I've tried to mockup and ask about.

enter image description hereenter image description hereenter image description here

enter image description here

  • Welcome to the site, @Ben. Because the last three versions have only 4 records (instead of the 7 total records) displayed in them, it took me a moment to figure out what you're asking. You may want to edit your mockup to make this clearer. Also, you may want to consider breaking it into multiple images (or one image with vertically-aligned examples) because the site shrinks it to a small enough size that it's hard to read. Nov 13, 2014 at 23:22
  • You could consider adding more context and some details about how the users interact with the app, and also why are you even considering to mix two different "entities" in the same table. Nov 14, 2014 at 0:24
  • @rewobs It's not uncommon to list different entities in a single grid when they play a common role - say, when selecting who should be invoiced for a new order. Every account holder should be listed, reguardless of whether the party is a person or a company.
    – Bevan
    Dec 13, 2014 at 22:42
  • Good collation is complicated and sometimes non-obvious to the naive user and implementer. You might want to highlight the parts of the string that are used as primary sort key, or deemphasize the rest, e.g. Emma <b>Watson</b> or <small>Emma</small> Watson.
    – Crissov
    Dec 14, 2014 at 2:56

2 Answers 2


Here are some suggestions ...

  • Retain your first grid suggestion - the existing one - but override the sort order for the Name column to sort people by their family name. Easy to achieve and easy to understand, but might be a little confusing for new users.


download bmml source – Wireframes created with Balsamiq Mockups

  • Provide a search/filter capability that reduces the number of rows shown to only those that match the filter. Depending on your technology stack, you may be able to do this entirely client-side, giving very good performance as you could update the grid on each keystroke. Some grids allow you to embed this as a filter row at the top/bottom of the grid itself.


download bmml source

If you're going to deliver the functionality by sorting, there are a few challenges to face.

  • Some common names don't sort where the computer would naturally place them. For example, "MacDonald, Roland" and "McDonald, Reginald" should be next to each other because "Mac" and "Mc" sort together.

  • You also can't assume that the name written last is the persons family name - in some common cultures/religions the name of the family is written first as a sign of respect. Instead of the commonly used but ambiguous First/Last name, perhaps you could use KnownAs/FamilyName.


You said it yourself in your question- your users want to search by last name, not sort. So I completely agree with Bevan's second answer- provide a filter mechanism for the rows of the table.

Some Javascript libraries offer this functionality for very little additional code on your part: http://www.jtable.org/Demo/Filtering

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.