You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello to everyone I want to ask something. I'm trying to use PopOvers of Flowbite. I coded with Laravel Livewire a Search Input Field that gets a value and search all the users that matches that value. Now I used a foreach in my view for this, and inside the foreach, I added the popovers. I used the wire:model.live to return the user in real time while typing. The popovers are not working though, since the "results of the input field are not present in the DOM". If I try console.logging the popover values, or the div where the users searched are, I get null since the component is waiting for someone to type inside the input search, after that It returns the users but the script already is gone and it returned null. How I can solve this?
MY LIVEWIRE CONTROLLER:
<?php
namespace App\Livewire;
use Livewire\Component;
use Livewire\Attributes\Url;
use Livewire\WithPagination;
class SearchUsers extends Component
{
public $searchTerm= '';
public $searchResults = [];
public function render()
{
$users = [];
if (!empty($this->searchTerm)) {
$users = \App\Models\User::where('username', 'like', '%' . $this->searchTerm . '%')
->orWhere('name', 'like', '%' . $this->searchTerm . '%')
->orWhere('email', 'like', '%' . $this->searchTerm . '%')
->get();
}
return view('livewire.search-users', ['users' => $users]);
}
public function search()
{
$this->searchResults = \App\Models\User::search($this->searchTerm)->get();
}
public function updatedSearchResults()
{
$this->dispatch('popovers');
}
}
My VIEW (note that Im using wire:model.live and a foreach)
Hello to everyone I want to ask something. I'm trying to use PopOvers of Flowbite. I coded with Laravel Livewire a Search Input Field that gets a value and search all the users that matches that value. Now I used a foreach in my view for this, and inside the foreach, I added the popovers. I used the wire:model.live to return the user in real time while typing. The popovers are not working though, since the "results of the input field are not present in the DOM". If I try console.logging the popover values, or the div where the users searched are, I get null since the component is waiting for someone to type inside the input search, after that It returns the users but the script already is gone and it returned null. How I can solve this?
MY LIVEWIRE CONTROLLER:
My VIEW (note that Im using wire:model.live and a foreach)
When trying to access to the HTML element with ID of "usersResults" with Javascript and doing a console.log it returns "null".
The text was updated successfully, but these errors were encountered: