Add dropdowns with filter (to everywhere)

Acs's profile image Acs posted 4 years ago in Feature discussion Permalink

Hey,

I am now creating a database and tables. It's a bit of a pain going through the collation list in dropdown searching for the one I want.

Would it be possible to add a filter? Like you click on the dropdown to expand and then start typing to filter out the one you want.

This would be useful wherever we have big dropdowns. Thanks

ansgar's profile image ansgar posted 4 years ago Permalink

These drop-downs support a "find as you type" feature. Just start typing text when it has focus, e.g "utf8", and you will see the list focuses the first one matching to it.

Acs's profile image Acs posted 4 years ago Permalink

Hey,

It finds the first letter, but if I type the second and shifts to a completely different place.

ansgar's profile image ansgar posted 4 years ago Permalink

Then you need to type quicker.

Acs's profile image Acs posted 4 years ago Permalink

I hope that you are just joking and that you understand that that is not an ideal solution.

What I was hoping is something like this:

image description

Here you can see I am typing the value and the dropdown is going to my selection (no actual items are removed, but you could add similar behavior to the filtering of tables)

ansgar's profile image ansgar posted 4 years ago Permalink

No I was not joking. I know that this is not ideal. However, allow free typing is an idea, but that would throw errors from the server if you mistype your collation, right?

Acs's profile image Acs posted 4 years ago Permalink

Sorry, I don't follow. How would it throw errors? When you type you are not selecting anything until you click. You are typing to navigate to the thing you want to select.

At least that is how I understand it, but even if you do the way you are saying, lets say you have X selected and you start typing something invalid, then no selection is made.

ansgar's profile image ansgar posted 4 years ago Permalink

That is correct. But you may also type a word which is not in the list. So for example:

Description

That would result in an SQL error when saving:

ALTER TABLE `mytable`
    CHANGE COLUMN `oid` `oid` VARCHAR(100) NOT NULL COLLATE 'utf8_NOTEXIST' AFTER `uid`;
/* SQL Error (1273): Unknown collation: 'utf8_NOTEXIST' */
Acs's profile image Acs posted 4 years ago Permalink

If you accept any value, yes, but if you check for the value in the list when the user presses enter or deselects then this could be avoided.

By default a value is selected when a field is created, so, then when the user tries to change it, the user must select a valid one, if no valid one is selected (the user typed the wrong thing) a popup error message shows up telling the user of an invalid selection and the selection doesn't change. The user could also press ESC to just cancel the search.

I have seen this exact behavior in other applications with editable dropdowns. I believe this would be a valuable addition to HeidiSQL

Code modification/commit 1585e0d from Ansgar Becker <anse@heidisql.com>, 4 years ago, revision 11.0.0.6113
Allow free typing in collation drop-down for collations in a column. Set to empty string if user typed a non existent item. See https://www.heidisql.com/forum.php?t=37117
ansgar's profile image ansgar posted 4 years ago Permalink

Yes, that's definitely worth a try. I just did the following for the next build:

  • allow free typing in the collation drop-down
  • assume an empty string in case the user typed a non existent item (instead of an error dialog)

Please try that out, and tell me what you think about it. Click Help > "Check for updates" to get the next build (available in some minutes).

Acs's profile image Acs posted 4 years ago Permalink

Just tried it out and it looks great:

image description

One thing I would add, is if the user presses ESC then cancel the change. Currently if I type something and press ESC (or the box loses focus) I get what the text I wrote selected, would be nice if it just cancelled, but this is just a very minor thing to add.

I think this is a great improvement and will make selections like this much much easier and if possible all the dropdowns where you have multiple items should have this.

Great work man, really great work. Thanks!!

Please login to leave a reply, or register at first.