Greetings,
I have been trying to get the following script to work with my Grid for date range filtering, but it does not execute. No errors, just blank results. My date format is YYYY-MM-DD. Not sure what I am missing. Any assistance would be appreciated. Thank you. This is a condensed script that I am using -
var mygrid;
function doOnLoad(){
mygrid = new dhtmlXGridObject("mygrid");
mygrid.setImagePath("codebase/imgs/");
mygrid.setHeader("Date YYYY-MM-DD, Patient Info, Accession Number");
mygrid.attachHeader("#daterange_filter,#connector_text_filter,#connector_text_filter");
mygrid.setInitWidths("150,200,200");
mygrid.setColAlign("left,left,left");
mygrid.setColTypes("ro,ed,ed");
dhtmlXGridObject.prototype._in_header_daterange_filter=function(a,b){
var mygrid=this
a.innerHTML="<div style='width:100%; margin:0 auto; text-align: left'>From:<input type='text'
style='width:80px;font-size:8pt;font-family:Tahoma;-moz-user-select:text;'><br>To:<input type='text'
style='width:80px;font-size:8pt;font-family:Tahoma;-moz-user-select:text;'></div>";
a.onclick=a.onmousedown=function(a){
return(a||event).cancelBubble=!0
};
a.onselectstart=function(){
return event.cancelBubble=!0
};
var datefrom = a.childNodes[0].childNodes[1];
var dateto = a.childNodes[0].childNodes[4]
var myCalendar = new dhtmlXCalendarObject([datefrom , dateto])
myCalendar.setDateFormat(mygrid._dtmask||"%Y-%m-%d"); //Date format YYYY-MM-DD
myCalendar.attachEvent("onClick",function(date){
mygrid.filterByAll();
})
this.makeFilter(datefrom ,b);
this.makeFilter(dateto ,b);
datefrom._filter=function(){
var a=this.value;
return a==""?"":function(b){
aDate = window.dhx4.str2date(a,this._dtmask)
bDate = window.dhx4.str2date(b,this._dtmask)
return aDate <= bDate ;
}
}
dateto._filter=function(){
var a=this.value;
return a==""?"":function(b){
aDate = window.dhx4.str2date(a,this._dtmask)
bDate = window.dhx4.str2date(b,this._dtmask)
return aDate >= bDate
}
}
this._filters_ready()
};
mygrid.init();
mygrid.enableHeaderMenu();
mygrid.enableSmartRendering(true);
mygrid.load("connector.php", function(){
});
var dp = new dataProcessor("connector.php");
dp.setTransactionMode("POST", true);
dp.init(mygrid);
}