How to filter foreign key on datatables with server side processing?

Viewed 234

How do i filter Foreign keys on a datatable with server side processing?

I'm using a datatable to display 3.500 entries from my sql server within Django/Ajax/Rest-Framework.

The table is working as intended when searching columns within the given table, but: Foreign key filtering appears not to be working. error i get when searching:

raise FieldError("Cannot resolve keyword '%s' into field. "
django.core.exceptions.FieldError: Cannot resolve keyword 'bib_tipo_nome' into field.
 Choices are:  autor, cadastro_id, datacriado, emailautor, referencia, tema, tema_id, tipo, tipo_id

Is there a solution for this? Do i need client-sided processing?

EDIT: filtering code:

html:
<th class="d-none d-sm-table-cell"> <input class="form-control d-none d-sm-block search" type="text" placeholder="tema" name="4"></th>

js:
inputSearch.forEach(item =>{
        function getInputSearch(){
          clearTimeout(timeout);
          timeout = setTimeout(function () {
            table.columns(item.name).search(item.value).draw();
          }, 800);
        };
          item.addEventListener("load",getInputSearch);
          item.addEventListener("keyup",getInputSearch);    
      });
0 Answers
Related