Custom select filter also sorting


I’ve added a custom select filter and it works:

grid_professionals_tots.attachHeader("#text_filter,#select_filter,#select_filter,#select_filter,<select onchange='grid_filtra_borsa(this.value)'><option/><option value='1'>Si</option><option value='2'>No</option></select>");

function grid_filtra_borsa(value) {
            var esNumero = !isNaN(data.toString());
            if (value == "1") return esNumero;
            else if (value == "2") return !esNumero;
            else return true;

The problem is that every time I click the select filter the column is sorted, and it should only sort if I click the empty space of the heather (like with the other standard filters).

Obviously I’ve the setColSorting enabled, and I need it.

How can I avoid that?


Please, try to use the cancelBubble property.

grid_professionals_tots.attachHeader("#text_filter,#select_filter,#select_filter,#select_filter,<select onchange='arguments[0]||window.event).cancelBubble=true;grid_filtra_borsa(this.value)'><option/><option value='1'>Si</option><option value='2'>No</option></select>");

Same problem :frowning:

I suppose there’s a typo in the proposed solution, I added a “(” at the beggining:


But the problem persist: … r_sort.mp4


Any idea? Tell me please if you need more information

Please, try to add the cancelBubble attribute in the onclick event:

<select onclick='(arguments[0]||window.event).cancelBubble=true;' onchange='grid_filtra_borsa(this.value)'><option/><option value='1'>Si</option><option value='2'>No</option></select>

Yes! It works! Thx :smiley: