6 months ago

Problem with infinite scroll select, in laravel 5.5

Posted 6 months ago by daniel21gt

How about, I have tried to make an infinite select with scroll, since currently the select that I have loads indefinitely many records, but in the end it will be uncomfortable to see such a large list, which is why I want a scroll in the select that loads everything what's in that field of the bd, this is what I have.

<table style="width:100%;" border="0">
        <td style="width:100%;" border="0">

            <select name="tipo" id="tipo" class=" form-control" value="{{ old('tipo') }}" required style="width:150px">
                @foreach($usuariosOpciones as $user_id => $usuario_ad)
                <option value="{{$user_id}}">{{ $usuario_ad }}</option>

        <td style="width:50%;" border="1">
            <button type="submit" class="btn btn-primary">enviar</button>

This is my controller.

public function selector(Request $request)


        $registrado = \Auth::user()->tipos_usuarios_id;
        $filtro = \Auth::user()->username;
        $filid = \Auth::user()->id;

      if($registrado == 1)

        $usuarios=usuarios::where("user_id", $request->tipo)->paginate(10);
        $usuarios->appends(['tipo'=> $request->tipo]);
        $usuariosOpciones=usuarios::pluck('usuario_ad', 'user_id')->unique();
        $conteo=usuarios::where('user_id', $request->tipo)->count();
        return view('usuario.index')->with(["usuarios" => $usuarios, "usuariosOpciones" => $usuariosOpciones, "conteo" => $conteo]);


I know there are several ways to do it with ajax or jquery for example, but I'm new to these languages, I still do not understand the logic to implement it in what I have, and thus achieve a simple scroll select.

Please sign in or create an account to participate in this conversation.