Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
Onchange Event my filter value get empty in List?

I'm updated my original array to become reactive template for my students array list with selection of name in JS ? when i select the button first time it brings up the filter correct value but if click on second iterative button it shows []. what's wrong with my code ?

 handlechange(event)
    
        {
         const value = event.target.value;
        this.students = this.students.filter(e=>e.name.startsWith(value));
        
        }

  

    <table className="table table-bordered">  
                <tr>  
                    <th>ID</th>  
                    <th>Name</th>  
                    <th>Email</th>  
                </tr>  
        
                {students.map((student, index) => (  
                  <tr data-index={index}>  
                    <td>{student.id}</td>  
                    <td>{student.name}</td>  
                    <td>{student.email}</td>  
                  </tr>  
                ))}  
               <button onclick={this.handlechange(student.name)}>click </button>
            </table>  
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Use another array to store (and display) your results. Do not modify your source.

handlechange(event)
{
  const value = event.target.value;
  this.filteredStudents = this.students.filter(e=>e.name.startsWith(value));       
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda