yesterdaysfoe
yesterdaysfoe

Reputation: 808

Jquery Datatable Sort Click Event in Table Header Not in Column Title Text

I have this table which I implement the Jquery-DataTables

and in that I have a Select All function that works well;

<thead>
  <tr>
    <th>
      <label>
        <input type="checkbox" > All
      </label>
    </th>
  </tr>
</thead>

the problem is when I clicked the checkbox the sort event of table is also being performed. what I want is, when I click on the Text "All" or the Checkbox the sort event will not perform, instead, it will only perform as usual if the table header(outside the Text or Checkbox) and the Sort-Icon is clicked.

any idea how to do it?

Upvotes: 0

Views: 2168

Answers (1)

yesterdaysfoe
yesterdaysfoe

Reputation: 808

I have solved this issue by running this script (from this) after initialization of Jquery-Datable to my table;

$('input').click(function (event) {
    event.stopPropagation();
});

hope it will help someone someday.

Upvotes: 1

Related Questions