Hi,
We have modified slightly an original DateRangeItem return object by appending hidden property "__ExactValueToServer", I thought that would not affect anything, but I was wrong.
Then listgrid "date" field is filtered by any relative date (from: yesterday, to: tommorow) any click on filter issues fetch to server (but ).
Bug is found in DataSource.compareValues(..) method
The problem is that DateRangeItem which is used in filter UI submits AdvancedCriteria values not a Date but object:
so original DataSource.compareValues() won't detect that these values are Date objects and compares it by unknown factor (as it always return that objects not equal)
patch we have applied to our system:
Affected: SmartClient_v100p_2016-01-12_LGPL and all previous
We have modified slightly an original DateRangeItem return object by appending hidden property "__ExactValueToServer", I thought that would not affect anything, but I was wrong.
Then listgrid "date" field is filtered by any relative date (from: yesterday, to: tommorow) any click on filter issues fetch to server (but ).
Bug is found in DataSource.compareValues(..) method
The problem is that DateRangeItem which is used in filter UI submits AdvancedCriteria values not a Date but object:
Code:
{ "_constructor" : "RelativeDate", "value" : "-5m[-0D]", "rangePosition" : "start", "logicalDate" : true, "_sendToServerValue" : "2015-08-13T21:00:00.000Z" }
patch we have applied to our system:
Code:
///<reference path='../Patch.ts'/> module smartclient.patches.bugfix { export class ListGridCriteriaComparisonForRelativeDatesBugfixPatch extends Patch { public initialize(isc):void { var parent = isc.RestDataSource.getPrototype()['compareValues']; isc.RestDataSource.addMethods({ compareValues: function (value1, value2, fieldName, ignoreCase) { return isDate(value1) && isDate(value2) ? this.compareDates(getAbsoluteDate(value1), getAbsoluteDate(value2), fieldName) : parent.apply(this, arguments); } }); } } function isDate(value) { return isc.isA.Date(value) || isc.DateUtil.isRelativeDate(value); } function getAbsoluteDate(value) { return isc.DateUtil.isRelativeDate(value) ? isc.DateUtil.getAbsoluteDate(value) : value; } }
Comment