Closed heyner29 closed 5 years ago
This is happening because the frontend filters also the matching options, and your label
does not contain the supplier.
I just added a disable-filtering
option for the FE component, but it would still be preferrable to add an accessor for this situation in your seller model:
public function getLabelAttribute() {
return $this->first_name.' '.$this->last_name.' - '.$this->supplier->name;
}
don't forget to add the supplier to the query()
public function query() {
return Seller::with('supplier');
}
and then set the FE components :label="label"
.
This will ensure a working filter with option highlighting, won't be awkward for the user when you'll have two similar names on different suppliers and you'll search by name, and will avoid n+1 queries.
Yes thank you, a similar approach had been done to achieve it.
In addition to your instructions you must use protected $appends = ['fullName', 'label'];
in the model.
Once again, thank you very much for your help.
This is a bug.
Prerequisites
Description
When several
$queryAttributes
are added, the component does not render them even if the backend responds well. This is my select without searchThis is my option controller
Actual behavior
When I perform the search by the
supplier.name
the component does not report resultsproandin
is the name of thesupplier