Can we control the filter columns

42 views
Skip to first unread message

flowe...@pwc.com

unread,
Mar 22, 2016, 10:37:35 PM3/22/16
to Handsontable
Hi, 
Can we control the filter columns, some columns need to filter but some columns not?

jacques....@gmail.com

unread,
May 1, 2016, 6:50:02 AM5/1/16
to Handsontable
Le mercredi 23 mars 2016 03:37:35 UTC+1, flowe...@pwc.com a écrit :
> Hi, 
> Can we control the filter columns, some columns need to filter but some columns not?

I have changed the code like that (handsontable pro 1.3.4) :

line 22444 old :

onAfterGetColHeader: function(col, TH) {
var headerRow = TH.parentNode;
var headerRowList = headerRow.parentNode.childNodes;
var level = Array.prototype.indexOf.call(headerRowList, headerRow);
if (col < 0 || level !== headerRowList.length - 1) {
return;
}
var existingButton = TH.querySelector('.' + BUTTON_CLASS_NAME);
if (this.enabled && existingButton) {
return;
}

new :

onAfterGetColHeader: function(col, TH) {
var headerRow = TH.parentNode;
var headerRowList = headerRow.parentNode.childNodes;
var level = Array.prototype.indexOf.call(headerRowList, headerRow);
if (col < 0 || level !== headerRowList.length - 1) {
return;
}
if (Object.prototype.toString.call( this.hot.getSettings().filters ) === '[object Array]' && this.hot.getSettings().filters.indexOf(col) === -1) {
return;
}
var existingButton = TH.querySelector('.' + BUTTON_CLASS_NAME);
if (this.enabled && existingButton) {
return;
}

and now if I set filters: true everything work like before and if I set filters: [0, 2, 5] then only columns 0 2 and 5 have filter menu ...
Reply all
Reply to author
Forward
0 new messages