Sunday, March 11, 2012

Drop down list for columns

What is the best practice to build drop down lists for a database?

for what?

for the login

|||You know a drop down list so on the front-end a user has predefined choices instead of having to type everything in each time.|||

You're asking about the best practices for the UI on the client side, then?

I think that depends on a coulpe of different things. If the query to generate the list is very simple, then I'd probably write code to retreive the data and populate the list each time the UI is shown.

But there are some exceptions. If the data is likely to change (that is, other users are adding or removing things that would show up in the list) I would end up adding a "Refresh" pushbutton next to the dropdown. That way, the user can refresh the content of the list without leaving and re-opening the form or dialog where the control lives. If the control actually is a part of more stable UI (like in a toolbar that's alive as long as the application is alive) you'll certainly want to provdie a refresh button. In places where screen area is limited, you might let the user hold CTRL while clicking the drop-down arrow to cause a refresh.

If the query is complicated and has a long run time, I'd look at ways to either cache the result (by storing it locally with the app; in a config file, or the registry, or so on) or by storing the user's most recent choice. (And I'd see if there was a way to tune the query!) This might no work if there's also lots of changes to the list.

If there are lots of results in the list, you should be sure to implement word wheeling for the control.

And that's all that I can think of for now. I hope it helps; if you have further questions, please do give us some more details about what it is you're doing and we'll see if we can help.

No comments:

Post a Comment