Filter table field by icon

0

I'm developing a filter on a Datatable table that consists of filtering a table according to the status, but the status column in the table has no string to compare with the filter and yes font-awesome icons. Would it be possible to make the filter, if possible would it be possible with pure Javascript?

Thisisthetablefilter:

functionfilterByText(filter,tdColumn){table=document.getElementById("table");
    tr = table.getElementsByTagName("tr");
    for (i = 0; i < tr.length; i++) {
        td = tr[i].getElementsByTagName("td")[tdColumn];
        if (td) {
            if (td.innerHTML.toUpperCase().indexOf(filter) === -1) {
                tr[i].style.display = "none";
            }
        }    
    } 
}

This is the Status filter I've done so far:

  function status() {
    var statusFilter, filter, status;
    status = document.getElementById("Enviado").getAttribute("id");
    statusFilter = document.getElementById("statusFilter").options[document.getElementById("statusFilter").selectedIndex];
    filter = statusFilter.text;

    if (status == filter) {
        alert(status);
        filtros(filter, 7);             
    }
    else{
        alert("Não é : " + status);
    }   
} 
    
asked by anonymous 30.10.2017 / 19:45

0 answers