Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3800

How to add an empty option for a field

$
0
0

Hello,
I've upgraded the datatable editor to the latest version and now I have an error in trying to add an empty option on a select field.

This is the C# script I used before and that it worked fine:

.Field(new Field("Goods.ID_Tank")
.Options("Tanks WHERE Is_Drum = 1 AND Enabled = 1 UNION SELECT 0, '' ", "ID", "Code")

Essentially, I read the ID and CODE columns from the Tanks table as the value/label for the options. However, by performing a UNION with an ID of 0 and an empty string (‘’) as the label, I used to add this value to the selectable options. Now, with the new version, I’m encountering an error of ‘INVALID COLUMN NAME’

I attempted to write it like this:

.Field(new Field("Goods.ID_Tank")
.Options("Tanks WHERE Is_Drum = 1 AND Enabled = 1 UNION SELECT 0 as ID, '' as Code ", "ID", "Code")

but the INVALID COLUMN NAME error persists.... any idea how I can solve this issue?

Thanks!

Ciao.


Viewing all articles
Browse latest Browse all 3800

Trending Articles