I wanted my cells to show one value in the grid, and show another value as a tooltip. Granted, the most obvious way to achieve that is to set cell's data as [value, tooltip], then have renderer and title callbacks to unpack needed value. Worked well, but broke sorting on this column (value is numeric). This is of course because JS cannot compare array with </> operators normally and coerce them to strings. But even after I defined sortMode callback for the column, the sort didn't work properly. So, looking at compareCells implementation https://github.com/vitmalina/w2ui/blob/master/src/w2grid.js#L977 , I would suggest that sortMode callback is called too late in this function.
The idea should be simple: as long as user has defined this callback, they expect it to take sorting decisions, so it should be called as soon as possible in this function. Actually, I'd suggest that it should be called before handling null values in there, because what if user doesn't agree with "all nulls, empty and undefined on bottom" and wants a different behavior? Why preclude them from achieving it?
I wanted my cells to show one value in the grid, and show another value as a tooltip. Granted, the most obvious way to achieve that is to set cell's data as
[value, tooltip], then have renderer and title callbacks to unpack needed value. Worked well, but broke sorting on this column (value is numeric). This is of course because JS cannot compare array with</>operators normally and coerce them to strings. But even after I definedsortModecallback for the column, the sort didn't work properly. So, looking atcompareCellsimplementation https://github.com/vitmalina/w2ui/blob/master/src/w2grid.js#L977 , I would suggest thatsortModecallback is called too late in this function.The idea should be simple: as long as user has defined this callback, they expect it to take sorting decisions, so it should be called as soon as possible in this function. Actually, I'd suggest that it should be called before handling
nullvalues in there, because what if user doesn't agree with "all nulls, empty and undefined on bottom" and wants a different behavior? Why preclude them from achieving it?