Problem with filtering between two dates

I’m trying to make a custom filter to search records between two specific dates. Unfortunately I didn’t succeed to complete it.

The problem where I’m running in to is that the filter only responds on the days. So filtering with month & year doesnt work.

My input fields are being implemented by a custom filter. #date_filter

Anyone suggestions for me to make this work?

Here’s a piece of my code.
I removed all the unnecessary code to make it a reasonable code to read.

[code] var mygrid;
var timeoutHnd;
var flAuto = false;

			    // create new grid
			    mygrid = new dhtmlXGridObject('mygrid_container');
			    //mysubgrid = new dhtmlXGridObject('mysubgrid_container');
	
			    // Defining coltypes
			    mygrid.setColTypes("sub_row_ajax,ro,ro,ro,ro,ed,ro,ed,ed,ro");

				 // initialize
			    mygrid.init();
			    
			    // Filtering
			    mygrid.attachHeader(",#text_filter,#select_filter,#date_filter,#text_filter,#text_filter,#select_filter,#text_filter,#text_filter");

			    // Database connection
			    gridQString = "include/data.php";

			    mygrid.loadXML(gridQString);
	
				    // Smart rendering
				    mygrid.enableSmartRendering(true);
				    mygrid.enablePreRendering(25);
				    mygrid.setAwaitedRowHeight(25);
	
			    //Sorting
			    mygrid.setColSorting("na,str,str,date,str,str,str")
			    
		        mygrid.attachEvent("onSubGridCreated",function(subgrid,id,ind,data){
        			mysubgrid.loadXMLString(subgridQString); // use the current data as configuration xml
         			return false; // prevent default behavior
     			})
     			
     			
     			var cal1, cal2
			    var dateFrom = null;
			    var dateTo = null;

			    dhtmlXCalendarObject.prototype.langData["nl"] = {
			    	    dateformat: '%d-%m-%Y',
			    	    monthesFNames: ["Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"],
			    	    monthesSNames: ["Jan", "Feb", "Maa", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
			    	    daysFNames: ["Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"],
			    	    daysSNames: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"],
			    	    weekstart: 1
			    	}

			    cal1 = new dhtmlxCalendarObject('calend1', false, {isMonthEditable: true, isYearEditable: true});
			    cal1.attachEvent("onClick",mSelectDate1);
			    cal1.loadUserLanguage("nl");
			    cal1.draw();
			    cal1.setSkin("dhx_skyblue"); 
			    cal1.setDateFormat("%d-%m-%Y");
			    cal1.hideTime();

				
			    cal2 = new dhtmlxCalendarObject('calend2', false, {isMonthEditable: true, isYearEditable: true});
			    cal2.attachEvent("onClick",mSelectDate2);
			    cal2.loadUserLanguage("nl");
			    cal2.draw();
			    cal2.setSkin("dhx_skyblue");
			    cal2.setDateFormat("%d-%m-%Y");
			    cal2.hideTime();
			    
			    function doFilter(){
			     mygrid.filterBy(3,function(val){
			       if(dateFrom==null){
			        return (val<=dateTo);
			       }else if (dateTo==null){
			        return (val>=dateFrom);
			       }else{
			        return ((val>=dateFrom)&&(val<=dateTo));
			       }
			      }); 
			     return true;
			    }
			    
			    function mSelectDate1(date) {
			     dateFrom = cal1.getDate(date);
			     doFilter();
			     return true;
			    }
			    function mSelectDate2(date) {
			     dateTo = cal2.getDate(date);
			     doFilter();     
			     return true;
			    }[/code]

Maybe a dhtmlxForum moderator can assist me?

Thanks in advance.

Unfortunately filter can’t detect the date format so

return (val<=dateTo);

will work only for the simple numbers.