filter a date field in the qdatagrid with a specific format
Wed, 03/10/2010 - 17:53
hi everybody!, i have a problem to filter a date field in the qdatagrid in other words my table employee have three fields(id, name, startdate) in my employee_list.php i created a filter for the startdate field like this:
QQN::Employee()->stardate->SetFilteredDataGridColumnFilter($this->dtgEmployee->GetColumnByName('startdate'));this code show me a filtertextbox in the startdate column(the format for startdate that the qdatagrid show is 'YYYY-MM-DD') then i changed the format of startdate to 'DD/MM/YYYY', but if i enter a date into textfilterbox of startdate in the format 'DD/MM/YYYY' for example: 15/02/2009 don't filter, because i think that this format is incorrect then in the database never found a row with this date(startdate='15/02/2009'); but if i enter a date in the format 'YYYY-MM-DD' for example: 2009-02-15 the qdatagrid filter, in this case i think that the sql sentence will be like this " startdate = '2009-02-15' that is the correct format.
I would like to know how to do that, when i send the text of the filtertextbox(text in format 'DD/MM/YYYY') change to the format 'YYYY-MM-DD', where i should change to do that? What property of filtertextbox i should change? some suggestion?
thanks for your time!!

Right now QDataGrid uses QQ::Like() when filtering on date columns.
You can either alter QQuery.class.php's SetFilteredDataGridColumnFilter function to change how you want this to behave, and have to manually re-apply your change every upgrade (since QQuery is a core file), or redo the Filter property on the column yourself to perform the query you want.
What QQCondition would work instead? Or what raw SQL?
Alternatively, you could make a new filter type in QDataGrid, and have a calendar date picker or something so that the format isn't user supplied. If you go this route, I'd love to take that work and put it into core. :)