sistemasjg
Accessing Repeater field from JS code in view
Yep, I think something like that as well. DOM is modified on JS side when creating the qr-view and maybe this modification is not tracked by livewire internals, so when updating it just set DOM like it was before plus modifications made. is ther any workaround? Maybe soe kind of notification to Livewire fro the JS side about the DOM was changed?
14 replies
Accessing Repeater field from JS code in view
Hi, update for this issue. I've trying differents approachs, but everything fails. I just changed repeater control for a simple texarea using registerListeners mechanism to add scaned line to texarea. Behaviour is the same, after first scan, line is added to textarea but qr-code field just dissapears. Is like it is reloading form/section and js component just dissapears. Any workaround could try? Thanks in advance
14 replies
How to get Model property from recordSelectOptionsQuery
Never mind, searched a little bit on this discord server and found a solution. Managed to do it this way:
RelationManager:
->recordSelectOptionsQuery(
function (Builder $query, $livewire)
{
// added $livewire parameter to access ownerRecord
if ($livewire->ownerRecord->allowedRelatedAttachTypes){
return $query->whereIn('trading_partners.type_id', $livewire->ownerRecord->allowedRelatedAttachTypes);
}
return $query;
}
)
Model:
class Student extends _TradingPartner
{
use HasFactory;
protected static $partnerType = 'S';
public $allowedRelatedAttachTypes = ['R'];
}
2 replies