Hi Thierry,
I have an (old) problem with the order of display in a grid.
On a column whose source field is a date, nothing happens when clicking on the title. All the other columns respond well.
Is there a special requirement for a column to be ordered ?
Found !
When the date of the current line (in grid) is empty, the classification does not take place.
Can we envisage a solution to this problem ?
Thanks in advance
The sorting mechanism lies inside ActiveWidgets so I need some time to figure out how we can override or complement it.
Meanwhile, if you use a cursor, you can try to replace empty dates by null
Select evl(date, .null.) as date …
I tried:
CAST (EVL (Dateouvert, .NULL.) AS D) AS Dateouvert
without success ...
Hi Vincent,
After further inquiry, ActiveWidgets considers an empty date as an erroneous data, probable reason why the sort does not happen (empty dates exist in VFP only).
We could maybe replace, in the XML data of the grid contents, all empty dates by a 'fake date' (e.g. 1000-01-01) and modify the client side display logic (see AW.Formats.DateVFP
in FoxInCloud.js
) to display an empty date instead.
Could you find a way to avoid an empty date?
Another alternative is to implement the sort on server side, e.g. by implementing header.click()
.
I may have found a solution… please try this fix in development mode:
In FoxInCloud.js (use an UTF-8 editor such as notePad++)
/* Date data format supporting empty date like VFP */
AW.Formats.DateVFP = AW.Formats.Date.subclass();
AW.Formats.DateVFP.create = function(){
AW.Formats.Date.create.call(this);
this.prototype.setErrorText(FoxInCloud.gridDateEmpty);
this.prototype.setErrorValue(0); // ADD THIS LINE
};
/* Datetime data format supporting empty date-time like VFP */
AW.Formats.DateTimeVFP = AW.Formats.Date.subclass();
AW.Formats.DateTimeVFP.create = function(){
AW.Formats.Date.create.call(this);
this.prototype.setErrorText(FoxInCloud.gridDateTimeEmpty);
this.prototype.setErrorValue(0); // ADD THIS LINE
};
Bravo Thierry !
It works perfectly
Could you also try this?
this.prototype.setErrorValue(new Date(1000, 0, 1)); // before any VFP date
Also good !
/* this.prototype.setErrorValue(0); // ADD THIS LINE - 18/02/2020 */
this.prototype.setErrorValue(new Date(1000, 0, 1)); // before any VFP date
Usable in production or is it better to wait a little bit ?