jquery - Column filter on button click in datatables -
morning all,
new datatables, python , jquery bear me. i'm trying datatables table imported through python filter on column results on button click. i've searched answers already, seem geared around text filters or selector filters, isn't i'm looking for.
here's jsfiddle mockup created:
https://jsfiddle.net/4m5up9bx/2/
<div align=center><a href="a" class="navy small btn">mapping tools</a> <a href="b" class="teal small btn">charting tools</a> <a href="c" class="green small btn">analyzing data</a> <a href="d" class="yellow small btn">programming tools</a> <a href="e" class="orange small btn">other data tools</a></div> <table id="tools" border=1 cellpadding=7> <thead> <th>program</th> <th>type</th> <th>skill level</th> <th>website</th> </thead> <tbody> <tr> {% obj in object_list %} <td><a href="{{ obj.id }}/">{{ obj.program }}</a></td> <td>{{ obj.type }}</td> <td>{{ obj.skill_level }}</td> <td><a href="{{ obj.website }}/">{{ obj.website }}</a></td> </tr> {% endfor %} </tbody> </table>
doesn't quite work without python give gist. start, table displays results, might expect. essentially, want allow click 1 of buttons , have table filter if column "type" equals set text value.
i have field ('type') includes 5 set values: mapping, charts, data analysis, programming , other.
so, if click mapping tools button, i'd datatable filter results {{obj.type}} = "mapping" thoughts?
you may use server-side datatable. can pass custom parameter object (ie, mapping, charts)to ajax request , fetch json data , show on datatable. or can check "generated content column"
Comments
Post a Comment