how do I filter out the same row in self referencing join

how do I filter out the same row in self referencing join

jimbizjimbiz Posts: 14Questions: 5Answers: 1

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

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    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 use field().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 the options property of that), and filter the list to remove the row being edited. That's probably the nicest way of doing it.

    Allan

This discussion has been closed.