Hi,
i have a class with a DATE-Field...
public static $db = array(
'paymentdate' => 'Date',
...
...
...
);
If the invoice is payed this field will save the date of payment.
If it is NULL it means the invoice hasnt been payed already.
In ModelAdmin I get a Searchfilter as an inputfield for filtering.
For me, it doesnt make sense to have an inputfield for filtering, because i dont want to search for invoices that are payed on a particular day.
I would like to have a dropdownbox with "any", "not payed", "payed" for filtering.
I can make a Dropdownfield for this, but i dont know how to define the filter, that searches for "paymentdate IS NULL"
public function getDefaultSearchContext() {
$context = parent::getDefaultSearchContext();
$context->removeFieldByName('paymentdate');
$paymentMap = array("" => "alle",
//"IS NULL" => "not payed",
"2000-01-01" => "payed");
$paymentField = new DropdownField('paymentdate', 'payed', $paymentMap);
$context->addField($paymentField);
$context->setFilters(array('paymentdate' => new GreaterThanFilter('paymentdate')));
return $context;
}