Reputation: 131
I have made the following table with NonFactors.Grid.Mvc5 library.
columns.Add(model => model.ApplicationName).Titled("Application").Filterable(true).Sortable(true);
I need to find a way to disable column from sorting when user clicks on "Application" column header and allowing sorting only when sort button next to it clicked?
I used stopPropagation method but it does not work.
label.click((e) => e.stopPropagation());
Upvotes: 0
Views: 216
Reputation: 131
I could do this by using e.stopImmediatePropagation() function. Now it works.
<script>
var sortables = $('table th').filter('.sortable');
sortables.each((i, e) => {
var header = $(e);
header.hasClass('sortable') ? header.removeClass('sortable') : null;
header.click((e) => {
e.stopImmediatePropagation();
});
});
Upvotes: 0