how do I filter out the same row in self referencing join
how do I filter out the same row in self referencing join
I want a drop down with all users except the current one in the row I am editing.
What do I put in the second value in the where clause below?
->table('users')
->value('id')
->label('name')
->order('name ASC')
->where(function ($r) {
$r->where('id', ?, '!=');
})
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What you are looking for would require a different set of options for every row. That's not how the
Options
class works I'm afraid - it uses a single set of options for all rows.If you want different options for each row use
preEdit
and make an Ajax call to the server to get the list of options, then usefield().update()
to update it with the list of options.If you don't want to make an Ajax call, you could use the options from the
Options
class (ajax.json()
to get the last JSON object loaded by DataTables - it's in theoptions
property of that), and filter the list to remove the row being edited. That's probably the nicest way of doing it.Allan