You can override GridDataSource:

So you can do something like:
This is something I did to put nulls at the bottom when a user sorts the
grid. I hope it is helpful.

@Override
 public void prepare(int startIndex, int endIndex, List<SortConstraint>
sortConstraints)
 {
   
       // your own initialization code
  
      for (SortConstraint constraint : sortConstraints)
      {
          final ColumnSort sort = constraint.getColumnSort();
          if (sort == ColumnSort.UNSORTED) continue;

          PropertyModel pm = constraint.getPropertyModel();
          final PropertyConduit conduit = pm.getConduit();
          Class type = pm.getPropertyType();
          
          final Comparator valueComparator = getComparator(type); //this is
a method you can use to get the comparator you need, something that checks
if it is string and maybe some other parameters
          final Comparator revValueComparator = getComparator(type);

          final Comparator rowComparator = new Comparator()
          {
              public int compare(Object row1, Object row2)
              {
                  Comparable value1 = (Comparable) conduit.get(row1);
                  Comparable value2 = (Comparable) conduit.get(row2);
                  return (ColumnSort.ASCENDING == sort)?
                        valueComparator.compare(value1, value2):
                        revValueComparator.compare(value1, value2);  
              }
          };
          Collections.sort(list, rowComparator); //list is the collection my
grid is sorting and is a member variable i passed in
      }

   }

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Grid-sorting-lowercase-uppercase-tp4887181p4896928.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to