Search fields several components

Hi,

Searching the way to wire an external field for n components ? Is it possible ?

What seems to be the problem: Would like one or several fields used by several components for a reporting

Steps to Reproduce:

Are you using the latest version of Livewire: yes

Do you have any screenshots or code examples:

Any ideas how can I do ?

I am not sure if I understand you correctly, can you please provide more information and an example in code what you are trying to accomplish?

It is possible to have external datepickers setup like that, see here for example: https://laravel-livewire.com/docs/alpine-js and that is about datepickers.

You could do that in a loop, buy don’t forget about the livewire key: Keeping Track Of Components In A Loop https://laravel-livewire.com/docs/nesting-components

Hi,

In fact all i want to do it’s to have a field (datepicker or other) wired by several components.

Imagine this :

<div>
<input type="text" class="daterange form-control" name="daterange" />
</div>

It will be perfect that this input will be shared by several components to deal with.
The perfect thing will be at the top of a blade view (not in a component). And then call Livewire components after with

@livewire('analytics-total-visitors-pageviews')
@livewire('analytics-component2') <= How can I pass the same input[name=daterange]
@livewire('analytics-component3') <= How can I pass the same input[name=daterange]

Do you see what I mean ?

I think that you want events in this setup. Just listen in the components for the event to happen. You can also pass parameters.

Edit: did you watch the screencasts? Events is the last one.

Do you think the input could be externalized (not in a component just in a blade view) and just listen with events ?

Nope I miss this screencast I think thanks again for your help

:+1: once you use them you realize how simple to use they really are… When I used them the first time I was flabbergasted :laughing: