Skip to content

Commit

Permalink
Fixed coupon search functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulmanann committed Dec 2, 2024
1 parent 267d1ad commit 5059c69
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions ecommerce/static/js/views/coupon_list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,15 @@ define([

if (!$.fn.dataTable.isDataTable('#couponTable')) {
couponTable = this.$el.find('#couponTable').DataTable({
serverSide: true,
ajax: this.url,
autoWidth: false,
lengthMenu: [10, 25, 50, 100],
info: true,
paging: true,
initComplete: function() {
$('#couponTable_filter input').unbind()
.bind('keyup', function(e) {
// If the length is 3 or more characters, or the user pressed ENTER, search
if (this.value.length >= 3 || e.keyCode === 13) {
couponTable.search(this.value).draw();
}

// Ensure we clear the search if they backspace far enough
if (this.value === '') {
couponTable.search('').draw();
}
.bind('keyup', function() {
couponTable.search(this.value).draw();
});
},
oLanguage: {
Expand Down

0 comments on commit 5059c69

Please sign in to comment.