jquery - Datatables filtering to be dynamic between columns -
when using column filtering in datatables, want once first column filter chosen , resulting dataset rendered, other columns filters refined shown.
see example: https://www.datatables.net/examples/api/multi_filter_select.html
if choose 'developer' position filter, location filter should refine 4 locations remaining. instead show locations original dataset. there way make refine them down each filter applied?
try hide options in drawcallback
drawcallback: function() { var api = this.api(); let data = api.rows({ filter: 'applied' }).data(); $.each($(api.table().footer()).find("select"), function(colindex) { var currdata = data.map(function(cols) { return cols[colindex]; }); $.each($(this).find("option"), function() { if (currdata.indexof($(this).text()) != -1 || $(this).text() == '') $(this).attr("disabled", false).show(); else $(this).attr("disabled", true).hide(); }) }); }
Comments
Post a Comment