Please use this to ignore hidden columns.
listener: function (evt) {
var val = evt.target.value, val2 = 0, indx2;
this.getColModel().forEach(function(col, indx){
if( !col.hidden ){
if(val2 == val){
indx2 = indx;
}
val2 ++;
}
});
this.option("freezeCols", indx2 );
this.refresh();
}