Hi Derrell,

thanks for your suggestions, but I like to "disagree" a bit ;)

1. <null>-values in tables are quite well handled as far as I can see in my
   application. I am using <null>-values all over the place here.
   The only thing that came up (so far) was when I changed the sorting to
   "case-insensitive"...
   But you are of cause correct with your "uncharted territory" warning ;)

2. I don't like the idea to change the content of the model data. This is a bad
   idea for my application because I do have empty strings ("") and
   <null>-value data. And on selection of row(s) I have to get the "raw data"
   for further evaluation.
   So I have to stick to the subclass approach, or patch my local framework
   copy.

Nevertheless, do you think it's worth filing a bug for this "special case" ?

Cheers,
  Peter


On 2010-05-25 15:28 Derrell Lipman wrote:
> 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

Reply via email to