No, don't do that. To filter by a year just use a range of greater than Jan 1 of that year, less than Dec 31 of that year.
Do this via providing a FormItemCriterionGetter that interprets the text (see getEnteredValue()) in this special way you want.
Announcement
Collapse
No announcement yet.
X
-
Hi mariusc,
I think you could do such thing if you treat the value as string, with all the disadvantages it brings.
To lower those, I'd definitely keep the column type as date, but perhaps you can change the filterOperator and filterEditorType, although I'm not sure this will work, as it does not here with
Code:fields: [ { name: "orderDate", filterOperator: "iContains", filterEditorType:"TextItem" } ]
It will definitely work if you create another version of your date column with a customSelectExpression and you DB-specific TO_CHAR as type="text" and set the sortField to you original field (all in your .ds.xml).
Best regards
Blama
Leave a comment:
-
Filter for partial date
Is there a way to filter a date coloumn in a list grid by inserting only the year and not a full date?
From what i know the isc.DateUtil.createLogicalDate(year, month, day) is called to parse the input value into a date object.
If i wanna filter only by the year, let's say 2017, the parsing fails and the filtering process can't take place because the criteria is empty.
This is the request:
First case has as an input value of 2017 and the second one a full date of 26.01.2018.
{
"_constructor":"AdvancedCriteria",
"operator":"and",
"criteria":[
]
}
Criteria is empty here!
{
"_constructor":"AdvancedCriteria",
"operator":"and",
"criteria":[
{
"fieldName":"lastLogin",
"operator":"equals",
"value":isc.DateUtil.createLogicalDate(2018, 0, 26)
}
]
}
I use smartGWT 5.1.
Thank you,
MariusTags: None
Leave a comment: