Hi,
We have a requirement where we have to create two date range filters which should filter the data by from date and to date. We have created custom filters like below:
dhtmlXGridObject.prototype._in_header_daterange_filter=function(a,b){
a.innerHTML="<div style='width:100%''><input id='datefrom' style='width:45%;float:left;font-size:11px;font-family:arial;'><input id='dateto' style='width:45%;float:left;font-size:11px;font-family:arial;'></div>";
a.onclick=a.onmousedown=function(a){
return(a||event).cancelBubble=!0
};
a.onselectstart=function(){
return event.cancelBubble=!0
};
datefrom = getChildElement(a.firstChild,"datefrom");
dateto = getChildElement(a.firstChild,"dateto");
myCalendar = new dhtmlXCalendarObject([datefrom , dateto])
formatDateforDHTMX();
myCalendar.setDateFormat(localDateFormat); //Date format MM/DD/YYY
myCalendar.hideTime();
myCalendar.attachEvent("onClick",function(date){
globalActiveDHTMLGridObject.filterByAll();
})
this.makeFilter(datefrom ,b);
this.makeFilter(dateto ,b);
datefrom._filter=function(){
var a=this.value;
return a==""?"":function(b){
aDate = parseDate(a)
bDate = parseDate(b)
return aDate <= bDate ;
}
}
dateto._filter=function(){
var a=this.value;
return a==""?"":function(b){
aDate = parseDate(a)
bDate = parseDate(b)
return aDate >= bDate
}
}
this._filters_ready()
};
This is working perfectly fine. But because of this we are getting problem with other column filters. Suppose if we have column 0,1,2,3,4,5 and #daterange_filter is applied to columns 2,3 then the filters on 4,5 columns(#text_filter etc) are not working. But if we remove this.makeFilter(dateto ,b); line in above code its working fine.
Can you please let us know what is the problem with above code?