I’m disturbing you for a problem that i’m not able to solve.
What i’d like to do is realize a filtering issue in Grid with “(Tutte)” in filter box, instead of blank, to unfilter the grid column and adding as second option “(Vuote)” to filter and list only the blank (or empty) cells in the column, like in Excel.
To make this issue i modified code in dhtmlx.js on dhtmlXGridObject.prototype._loadSelectOptins
var f=this._filter_tr?this._filter_tr[c]:null;
for (var i=0;i<l.length;i++)
t.options[t.options.length]=new Option(f?f(l[i]):l[i],l[i]);
t.value=v;
}
My two personal Options are regularly shown in filter box and (Tutte) option runs correctly unfiltering the column. The problem is my second Option. If, for istance, i write a real value present in the column, the filter runs filtering the cells with that value but if i write “” the issue is unfiltering the column as previous (Tutti).
If i write null no rows are selected while i’d like to list rows with empty cells in the filtered column.
i’m disperating asking your help. I don’t know how to make application recognizing the empty cells.
I found a solution redefining the filter logic through:
getFilterElement(column)._filter …
and it works fine with #select_filter. Now i want to use #combo_filter that is more flexible but i’ve tre basic problems:
the customization that i indicated in my previous post doesn’t run (the first item of combo is simply a blank row).
the customization of filter logic with getFilterElement(column)._filter seems not running.
i’d want to fill the combo with checboxes for the various option to obtain a kind of multiselect filter to use in my filter logic (a filter excel like), but i don’t know how fill the combo with checboxes and in which event.
but i’ ve a problem. I need for my code the reference to the grid that contains the filter, to call collectValues function. I thought to use “this” for reference to grid but it doesn’t run in this context because i always receive an error: “Object doesn’t support this property or method”. I f i use the real name of my Grid, code runs correctly, but of course i’ve to use the contextual name depending on filter that i select.
that run with select and not with Combo, and so then i use: getFilterElement(column)._filter that is used with select and not with Combo.
My problem i another:
Inside the dhtmlXGridobject.prototype._in_header_select_filter, that i’m modifying i need a reference to the GRID OBJECT (i tried with ‘this’ but it doesn’t run) to call the function collectValues. I don’t know, in this context, how to get this reference.
I tought that ‘this’ was referred to the Grid too, but, inside the function when i call the collectValues ‘this.collectValues(column)’ i have always this error:
Are you using some inline sub-functions inside of _in_header_select_filter?
While “this” will point to the grid object directly in the body of _in_header_select_filter, it will not work for sub-functions.
You may do the next
dhtmlXGridObject.prototype._in_header_select_filter=function(t,i){
var gridobj = this;
... any other code ...
};
With above code, you can use gridobj in any other code, including sub-functions.
Of course it runs correctly ! But solved a problem there is another !
In my code, clicking on filter select i open a box to choose filters avoiding to show the default select list:
I used this code: t.innerHTML="";
in ‘dhtmlXGridObject.prototype._in_header_select_filter’ and always run correctly, but when i double click on the select the list opens the same.
I try to catch the dblclick event but it seems to happen after list opening and so i can’t avoid it. Is there some other event to catch to avoid this default list ?