On Tue, May 25, 2010 at 08:29, Peter Schneider <[email protected]>wrote:
> Hello,
>
> I have found an issue in the current framework (1.2-pre/trunk):
>
> When you set the 'caseSensitiveSorting' property of the table-model to
> 'false',
> the sorting does not work when the model-data contains <null> values.
>
Hi Peter,
There may be other problems with having null values in the table. The table
isn't really intended to handle null as text, so patching this particular
bug is somewhat of a kludge without a complete review of other possible
places where null would break things.
I see two alternatives for you:
1. The way that I would deal with this is to put an empty string in the
model instead of null, so in your playground sample, replace this:
var cNull = c.match(/[A-Za-z]/) ? c : null;
with this:
var cNull = c.match(/[A-Za-z]/) ? c : "";
2. Subclass the qx.ui.table.model.Simple to modify it as you suggested. Be
warned, though, that you're in uncharted territory, and may encounter other
issues as well.
Cheers,
Derrell
> See http://tinyurl.com/23xd9tg for a demonstration
>
> Attached you will find a patch for
> "./framework/source/class/qx/ui/table/model/Simple.js"
> that fixes this issue for me.
> (This is what it changes: Whether to use "toLowerCase()"-method or not,
> depends
> on the result of "qx.lang.Type.isString(...)" now, that's all.)
>
>
> Do you like me to file a bug for this, or can the issue be fixed by someone
> of the framework-team without filing one?
>
> Best Regards,
> Peter
>
> Index: Simple.js
> ===================================================================
> --- Simple.js (Revision 22240)
> +++ Simple.js (Arbeitskopie)
> @@ -84,9 +84,9 @@
> */
> _defaultSortComparatorInsensitiveAscending : function(row1, row2)
> {
> - var obj1 = (row1[arguments.callee.columnIndex].toLowerCase ?
> + var obj1 =
> (qx.lang.Type.isString(row1[arguments.callee.columnIndex]) ?
> row1[arguments.callee.columnIndex].toLowerCase() :
> row1[arguments.callee.columnIndex]);
> - var obj2 = (row2[arguments.callee.columnIndex].toLowerCase ?
> + var obj2 =
> (qx.lang.Type.isString(row2[arguments.callee.columnIndex]) ?
> row2[arguments.callee.columnIndex].toLowerCase() :
> row2[arguments.callee.columnIndex]);
>
> if (qx.lang.Type.isNumber(obj1) && qx.lang.Type.isNumber(obj2)) {
> @@ -130,9 +130,9 @@
> */
> _defaultSortComparatorInsensitiveDescending : function(row1, row2)
> {
> - var obj1 = (row1[arguments.callee.columnIndex].toLowerCase ?
> + var obj1 =
> (qx.lang.Type.isString(row1[arguments.callee.columnIndex]) ?
> row1[arguments.callee.columnIndex].toLowerCase() :
> row1[arguments.callee.columnIndex]);
> - var obj2 = (row2[arguments.callee.columnIndex].toLowerCase ?
> + var obj2 =
> (qx.lang.Type.isString(row2[arguments.callee.columnIndex]) ?
> row2[arguments.callee.columnIndex].toLowerCase() :
> row2[arguments.callee.columnIndex]);
> if (qx.lang.Type.isNumber(obj1) && qx.lang.Type.isNumber(obj2)) {
> var result = isNaN(obj1) ? isNaN(obj2) ? 0 : 1 : isNaN(obj2) ? -1
> : null;
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
--
"There are two ways of constructing a software design.
One way is to make it so simple that there are obviously no deficiencies.
And the other way is to make it so complicated that there are no obvious
deficiencies."
C.A.R Hoare
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel