On Thu, 2007-11-22 at 15:01 +0100, Fa. Linstep, Stefan Volbers wrote:
> Hi Tobias,
> 
> within qooxdoo0.6.6, I helped myself by overriding qx.Proto.sortByColumn
> in a custom sorting table model which is derived from 
> qx.ui.table.SimpleTableModel, like that:

This is pretty interesting.. It would be nice to have this functionality
on 0.7 via something like tableModel.setCaseInsensitiveSorting(true).

I could make a patch, using this code, if it would have a chance of 
being pushed in.


> 
> ------------
> qx.Proto.sortByColumn = function(columnIndex, ascending) {
>    // NOTE: We use different comperators for ascending and descending,
>    //     because comperators should be really fast.
>    var comparator;
>    if (ascending) {
>      comparator = function(row1, row2) {
>        var obj1 = (isNaN(row1[columnIndex]) ? 
> row1[columnIndex].toLowerCase() : row1[columnIndex]); // overridden
>        var obj2 = (isNaN(row2[columnIndex]) ? 
> row2[columnIndex].toLowerCase() : row2[columnIndex]);
>        return (obj1 > obj2) ? 1 : ((obj1 == obj2) ? 0 : -1);
>      }
>    } else {
>      comparator = function(row1, row2) {
>        var obj1 = (isNaN(row1[columnIndex]) ? 
> row1[columnIndex].toLowerCase() : row1[columnIndex]);
>        var obj2 = (isNaN(row2[columnIndex]) ? 
> row2[columnIndex].toLowerCase() : row2[columnIndex]);
>        return (obj1 < obj2) ? 1 : ((obj1 == obj2) ? 0 : -1);
>      }
>    }
> 
>    this._rowArr.sort(comparator);
> 
>    this._sortColumnIndex = columnIndex;
>    this._sortAscending = ascending;
> 
>  
> this.createDispatchEvent(qx.ui.table.TableModel.EVENT_TYPE_META_DATA_CHANGED);
> }
> 
> HTH
> 
> Bye
> Stefan
> 
> 
> Tobias Koller (GERMO GmbH) schrieb:
> > hi hist,
> > 
> >  
> > 
> > how can I sort the table if there are uppercase and lowercase strings in 
> > on column?
> > 
> >  
> > 
> > f.e: I have the following entries in column 1:
> > 
> >  
> > 
> > A
> > 
> > a
> > 
> > B
> > 
> > b
> > 
> > C
> > 
> > c
> > 
> >  
> > 
> > if I sort them asc then it looks like:
> > 
> >  
> > 
> > A
> > 
> > B
> > 
> > C
> > 
> > a
> > 
> > b
> > 
> > c
> > 
> >  
> > 
> >  
> > 
> > did I make something wrong?
> > 
> >  
> > 
> > Thanks
> > 
> > Tobias
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2005.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > qooxdoo-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-- 
---------------------------
     Raúl Gutierrez S.
 Investigación y Desarrollo
   Taller de Ideas S.A. 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to