Editor: Adding where clause to server side script for a Field Select Type
Editor: Adding where clause to server side script for a Field Select Type

HI, having problems is the Editor Form displaying the correct data in a select (dropdown). The documentation at https://editor.datatables.net/docs/1.8.0/php/class-DataTables.Editor.Options.html states there is a where clause available but whenever I add it it returns an empty list. Without the where clause I get all entries.
What am I doing wrong I have tried the following as well as ->where ('to_type')
Field::inst( 'to_ports.switch_id')
->options( Options::inst()
->table( 'switches' )
->value( 'id' )
->label( 'name' )
->where( 'to_type', '=','1' )
)
->set(false)
Interestingly the debug output gives this query which is obviously wrong as the 'to_type' should be NOT NULL
query: "SELECT DISTINCT `id` as 'id', `name` as 'name' FROM `switches` WHERE `to_type` IS NULL "
Documentation does not give any examples for this that I can see, any help appreciated. Also no errors thrown anywhere
This question has an accepted answers - jump to answer
Answers
Any ideas from anyone on this? I think it may be a bug as I have looked through the code and cannot see how the where clause is computed
If that's the condition you want, use:
Regards,
Allan
Thanks Allan, that did the trick, I didn't realise I had to call a function....