Courses

$('#example2').dataTable({ dom: 'Bfrtip', aLengthMenu: [ [10, 20, 50, 100, 200, -1], [10, 20, 50, 100, 200, "All"] ], aaSorting: [[2, 'asc']], buttons: [ 'pageLength', 'excel', 'print' ] }); // use value of search field to filter var $quicksearch = $('.quicksearch').keyup(debounce(function () { qsRegex = new RegExp($quicksearch.val(), 'gi'); $grid.isotope(); }, 200)); // debounce so filtering doesn't happen every millisecond function debounce(fn, threshold) { var timeout; threshold = threshold || 100; return function debounced() { clearTimeout(timeout); var args = arguments; var _this = this; function delayed() { fn.apply(_this, args); } timeout = setTimeout(delayed, threshold); }; } // filter functions var filterFns = { // show if number is greater than 50 numberGreaterThan50: function () { var number = $(this).find('.number').text(); return parseInt(number, 10) > 50; }, // show if name ends with -ium ium: function () { var name = $(this).find('.name').text(); return name.match(/ium$/); } }; // bind filter on radio button click $('.filters').on('click', 'input', function () { // get filter value from input value var filterValue = this.value; // use filterFn if matches value filterValue = filterFns[filterValue] || filterValue; $grid.isotope({ filter: filterValue }); });