I am working on column filter in .NET MVC project. my requirement is, in a dropdown control all table header column name will bind with the checkbox. By default, all option are selected. When I deselect from dropdown any option it reflects to table data and that column will not be shown.
I write some code but not able to implement checkbox functionality. Please help me. If jquery plugin is available that also helpful for me.
Code
$("#myOptions").change(function() {
selectedVal = $.trim($("#myOptions option:selected").text());
var i = $("#myTable thead .headercell td:contains(" + selectedVal + ")").index() + 1;
$('td:nth-child(' + i+ ')').toggle();
});
Aucun commentaire:
Enregistrer un commentaire