I have a TDBLookupComboBox
showing a TStringField
of kind fkLookup
, which allows Null
values (from a nullable Integer database column).
The dropdown list displays the items from the assigned LookupDataSet
, which comes from a joined table. If the field is Null
, none of the list items are displayed, the combobox is empty. If the field has a value, the correct description is shown.
I can reset it to Null
by pressing the assigned NullValueKey
.
That's all ok, but the users prefer using the mouse. So I could provide a clear button, but I think an additional row on top of the list would be much better. How can I do that?
You can put the empty row in your query, and if you need it sorted you can make it appear at the top in your list like this:
select 0 as sort,
convert(int, null) as UserID,
'Clear' as Name
union all
select 1 as sort,
u.UserID,
u.Name
from tblUser u
order by sort, Name
The sort
column will make it appear at the top, after that you can sort on whatever you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With