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

256
Vistas
Filtering a table by a <select> clause with Django

I have a table that needs to be filtered on a select HTML clause giving a functionality like an excel filter. How can this filtering can be implemented? I want to filter it by owner

Table Example:

 <table class="table table-hover">
    <thead class="table-bordered">
        <tr>
        <th scope="col">NumberID</th>
        <th scope="col">Title</th>
        <th scope="col">
          Owner
          <select name="columns"  class="form-select" aria-label="Default select example">
                    <option selected>All</option>
                    <option value='option1' id="filterOwner">1</option>
                    <option value='option2' id="filterOwner">2</option>
                    <option value='option3' id="filterOwner">3</option>
                    <option value='option4' id="filterOwner">4</option>
                    <option value='option5' id="filterOwner">5</option>
           </select>
        </th>
        <th scope="col">Status</th>
        </tr>
    </thead>
    <tbody id='myTable'>
        {% for data in dataset %}

                <tr>
                <td>{{ data.NumberID }}</a></td>
                <td>{{ data.title }}</a></td>
                <td>{{ data.owner }}</a></td>
                <td>{{ data.currentMonthStatus }}</a></td>
                <td>
                  <a type="button" class="btn btn-outline-success btn-sm" href="/updatecontrol/{{data.NumberID}}">edit utility control</a>
                  
                </td>
                </tr>
        {% endfor %}
    </tbody>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should use forms for filtering operations.

Example Form:

class MyForm(forms.Form):
    CHOICES = (('Option 1', 'Option 1'),('Option 2', 'Option 2'),)
    field = forms.ChoiceField(choices=CHOICES)

If you want to perform the operation without POST or refreshing the page, you should use AJAX.

You can assign the options you want as CHOİCES and print them in the html page.

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