Sorry for wasting your time, that was my fault.
I was using string representation of dates while constructing criteria
value:"Sun Nov 18 00:00:00 MSK 2012"
instead of
value:new Date(1353182400000).
Missed that=((
Many thanks for help.
Announcement
Collapse
No announcement yet.
X
-
Applying criteria to a grid with a FilterEditor will potentially normalize the criteria so that the parts that are editable in the FilterEditor are in the same format that an editable form would return them.
You *may* have identified some kind of round-tripping bug here in terms of applying the criteria and getting something different back. We'd need to see runnable code to really tell - if it's as simple as your description you could probably make it happen in any sample with a date field.
Leave a comment:
-
Ok
Criteria passed to listGrid.filterData is
log (seems like criteria was transfomed by inner SmartGWT code again?)Code:{operator=and, criteria=[ {fieldName=lastName, operator=iContains, value=John, {operator=and, criteria=[ {fieldName=datebirth, operator=greaterOrEqual, value=Sun Nov 18 00:00:00 MSK 2012}, {fieldName=datebirth, operator=lessOrEqual, value=Wed Dec 19 23:59:59 MSK 2012}]}], _constructor=AdvancedCriteria}
Seems like HibernateDataSource was unable to manage it.Code:=== 2012-12-18 01:17:20,392 [0-71] DEBUG RPCManager - Request #1 (DSRequest) payload: { criteria:{ operator:"and", criteria:[ { fieldName:"lastName", operator:"iContains", value:"John" }, { fieldName:"datebirth", operator:"greaterOrEqual", value:"Sun Nov 18 00:00:00 MSK 2012" }, { fieldName:"datebirth", operator:"lessOrEqual", value:"Wed Dec 19 23:59:59 MSK 2012" } ], _constructor:"AdvancedCriteria" }, operationConfig:{ dataSource:"users", operationType:"fetch", textMatchStyle:"substring" }, startRow:0, endRow:75, componentId:"isc_EtgListGrid_0", appID:"builtinApplication", operation:"listFetch", oldValues:{ operator:"and", criteria:[ { fieldName:"lastName", operator:"iContains", value:"John" }, { fieldName:"datebirth", operator:"greaterOrEqual", value:"Sun Nov 18 00:00:00 MSK 2012" }, { fieldName:"datebirth", operator:"lessOrEqual", value:"Wed Dec 19 23:59:59 MSK 2012" } ], _constructor:"AdvancedCriteria" } } === 2012-12-18 01:17:20,393 [0-71] INFO IDACall - Performing 1 operation(s) === 2012-12-18 01:17:20,398 [0-71] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2012-12-18 01:17:20,398 [0-71] DEBUG DeclarativeSecurity - DataSource users is not in the pre-checked list, processing... === 2012-12-18 01:17:20,398 [0-71] DEBUG DeclarativeSecurity - Processing security checks for DataSource departments, field name === 2012-12-18 01:17:20,398 [0-71] DEBUG DeclarativeSecurity - DataSource departments is not in the pre-checked list, processing... === 2012-12-18 01:17:20,398 [0-71] DEBUG DeclarativeSecurity - Processing security checks for DataSource rubSections, field name === 2012-12-18 01:17:20,398 [0-71] DEBUG DeclarativeSecurity - DataSource rubSections is not in the pre-checked list, processing... === 2012-12-18 01:17:20,398 [0-71] DEBUG AppBase - [builtinApplication.listFetch] No userTypes defined, allowing anyone access to all operations for this application === 2012-12-18 01:17:20,398 [0-71] DEBUG AppBase - [builtinApplication.listFetch] No public zero-argument method named '_listFetch' found, performing generic datasource operation === 2012-12-18 01:17:20,399 [0-71] INFO HibernateDataSource - [builtinApplication.listFetch] Performing fetch operation with criteria: {criteria:[{fieldName:"lastName",operator:"iContains",value:"John"},{fieldName:"datebirth",operator:"greaterOrEqual",value:"Sun Nov 18 00:00:00 MSK 2012"},{fieldName:"datebirth",operator:"lessOrEqual",value:"Wed Dec 19 23:59:59 MSK 2012"}],operator:"and",_constructor:"AdvancedCriteria"} values: {criteria:[{fieldName:"lastName",operator:"iContains",value:"John"},{fieldName:"datebirth",operator:"greaterOrEqual",value:"Sun Nov 18 00:00:00 MSK 2012"},{fieldName:"datebirth",operator:"lessOrEqual",value:"Wed Dec 19 23:59:59 MSK 2012"}],operator:"and",_constructor:"AdvancedCriteria"} === 2012-12-18 01:17:20,404 [0-71] DEBUG HibernateTransaction - [builtinApplication.listFetch] Started new transaction "902620936" === 2012-12-18 01:17:20,404 [0-71] WARN HibernateDataSource - [builtinApplication.listFetch] Trying to compare date type field 'datebirth' with java.lang.String type value in criterion 'greaterOrEqual' === 2012-12-18 01:17:20,404 [0-71] WARN HibernateDataSource - [builtinApplication.listFetch] Trying to compare date type field 'datebirth' with java.lang.String type value in criterion 'lessOrEqual' === 2012-12-18 01:17:20,404 [0-71] INFO HibernateDataSource - [builtinApplication.listFetch] Query string: select _User, position1, department2 from ru.eurotechnologygroup.etgcrm.server.model.User _User left outer join _User.position position1 left outer join _User.department department2 where ((lower(_User.lastName) like lower(:p0) escape '~' and _User.lastName is not null) and 1=2 and _User.datebirth is not null and _User.datebirth is null) === 2012-12-18 01:17:20,404 [0-71] DEBUG HibernateDataSource - [builtinApplication.listFetch] Parameter p0: %John% === 2012-12-18 01:17:20,404 [0-71] DEBUG SQL - select count(*) as col_0_0_ from suser user0_ where (lower(user0_.USERLASTNAME) like lower(?) escape '~') and (user0_.USERLASTNAME is not null) and 1=2 and (user0_.USERDATEBIRTH is not null) and (user0_.USERDATEBIRTH is null) === 2012-12-18 01:17:20,410 [0-71] INFO DSResponse - [builtinApplication.listFetch] DSResponse: List with 0 items
After fetch DateRange picker field in filter editor looses it's value, and range picker window looks like screenshot on submit (warngings say it's not a date).
Probably it's worth mentioning that originally date range was submitted as RelativeDate expression and was converted by DataSource.convertRelativeDates().
Sounds not so simple now...
But anyway everything works fine with extra "_constructor=AdvancedCriteria" added in criteria as it was stated in my first post, so i was assuming the format is incorrect.
And even more, requests in log differ only in "_constructor=" position, this can be the only cause btw and not the extra _constructor...
Not working
workingCode:=== 2012-12-18 01:17:20,392 [0-71] DEBUG RPCManager - Request #1 (DSRequest) payload: { criteria:{ operator:"and", criteria:[ { fieldName:"lastName", operator:"iContains", value:"John" }, { fieldName:"datebirth", operator:"greaterOrEqual", value:"Sun Nov 18 00:00:00 MSK 2012" }, { fieldName:"datebirth", operator:"lessOrEqual", value:"Wed Dec 19 23:59:59 MSK 2012" } ], [b]_constructor:"AdvancedCriteria"[/b] },
Have i described everything clear enough or any additional details needed?Code:criteria:{ operator:"and", [b]_constructor:"AdvancedCriteria",[/b] criteria:[ { fieldName:"lastName", operator:"iContains", value:"Ост" }, { fieldName:"datebirth", operator:"greaterOrEqual", value:new Date(1353182400000) }, { fieldName:"datebirth", operator:"lessOrEqual", value:new Date(1355947199000) } ] },Last edited by vostapenko; 17 Dec 2012, 13:42.
Leave a comment:
-
There's nothing wrong with those criteria (the _constructor marker is not expected to be present at every level of a nested AdvancedCriteria object).
However, if you think this creates some kind of issue with a DateRange control, can you show how that can be reproduced?
Leave a comment:
-
AdvancedCriteria constructor produces incorrect criteria
v8.3p_2012-12-15/PowerEdition Deployment (built 2012-12-15)
produced criteriaCode:new AdvancedCriteria(OperatorId.AND, new Criterion[]{new AdvancedCriteria(OperatorId.AND, new Criterion[]{new Criterion("test", OperatorId.AND, "test")})})
The correct criteria should be:Code:{operator=and, criteria=[{operator=and, criteria=[{fieldName=test, operator=and, value=test}]}], _constructor=AdvancedCriteria}
Incorrect one can't be parsed by widgets, for example by DateRange picker in listgGrid filter editor.Code:{operator=and, criteria=[{[b]_constructor=AdvancedCriteria[/b], operator=and, criteria=[{fieldName=test, operator=and, value=test}]}], _constructor=AdvancedCriteria}
This bug is blocking my custom criteria parsing mechanism, which i was forced to implement because of
http://forums.smartclient.com/showthread.php?t=24439
http://forums.smartclient.com/showthread.php?t=9756
and multiple bugs in DataSource.combineCriteria() which are not submitted by me yet.
So seems like bug workarounding is blocked by another bug=(
Or please, suggest a workaround or a method to generate AdvancedCriteria from Map on the client side (including correct handling of _constructor=RelativeDate), something like Evaluator.parseAdvancedCriteria().
Thank you.Tags: None
Leave a comment: