Custom select filter also sorting

Hi,

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) {
        grid_professionals_tots.filterBy(4,function(data){
            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).
Screenshot: i.imgur.com/ekAf2iK.png

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

How can I avoid that?

Thx

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:

onchange='(arguments[0]||window.event).cancelBubble=true;grid_filtra_borsa(this.value)'

But the problem persist: dl.dropboxusercontent.com/u/171 … r_sort.mp4

:cry:

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: