asp.net - Filtering jquery datatable based on a column value -
I am using jQuery Datatable for my table lists here. My table structure is
< Code> username | Education --------------------------------------------- Philip Bachelor john | Post Graduate Alex | Graduate Emily | PhD Allen | Posted in Graduate George | PHD ................................................. ............................................... ...... ................. Tom | graduate ------------------------------------------------- -----But I need to place a dropdown next to a text dropbox that has 3 options, when we choose the first option, the graduation, which will only show the list of graduates, In the same way if we choose PhD, which will list only PhD users, hope that the question is clear.
Also sharing my data call
$ ('# tbl_users'). DataTable ({"sDom": "& lt; 'row' & lt; 'call-MD-6'i & gt; & lt;' call-MD-3'f & gt; & gt; T & lt; ' Space20 '& lt;' line '& lt; call-MD-3'l & gt; & # 39; Col-md-9'p & gt; & gt; "," sPaginationType ":" bootstrap "," Olanguage ": {" sInfo ":" & lt; span class = 'Label label-info' & gt; _START_ in & lt; span class = 'label label-info' Gt; _END_ & lt; / span & gt; Information about label '& gt; _TOTAL_user & lt; / span & gt; alert alert-info' & gt; any user in this account & lt; / div & Gt; "," sSearch ":" & lt; span class = 'input-icon' & gt; & lt; i class = 'clip-search-2' & gt; & lt; / I & gt; ; ____PUT_ & lt; / span & gt; "," sLengthMenu ": '& lt; div Class = "form-group" & gt; select class = "form-control" & gt; '+' & lt; option value = "6" option "=" 20 "& gt; 20 & lt; / Option & gt; '+' & lt; Option Value = "50"> 50 gt; '+' & lt; Option Value = "- 1" & gt; All & lt; / option & gt; '+' & lt; / select & gt; / page & lt; / Div & gt; '}, "IDisplayLength": 6, "bDestroy": True, "bSort": wrong, "aoColumnDefs": [{' bSortable ': wrong,' aTargets': [0]}]});
Hope the situation is clear ...
You can use the function for it.
MySelectList has an ID in its new selection list, you will create a listener for the change event and call
fnFilter , pass the selected value.
$ ("# MySelectList"). On ('change', function () {oTable.fnFilter (this.value, 0);});
To make this work, you will need to start your statistics like this:
var oTable = $ ('# tbl_users'). DataTable ({...
Depending on how you are populating the data, you will need to complete the custom filter value in CodeBehint. If you are doing this then what will be the parameter
Can be requested in ["sSearch_0"]
Comments
Post a Comment