[Checkins] SVN: z3c.table/branches/lazyvalues2/src/z3c/table/ store a reference to the sorting column

Godefroid Chapelle gotcha at bubblenet.be
Thu Aug 5 06:11:07 EDT 2010


Log message for revision 115492:
  store a reference to the sorting column

Changed:
  U   z3c.table/branches/lazyvalues2/src/z3c/table/sort.txt
  U   z3c.table/branches/lazyvalues2/src/z3c/table/table.py

-=-
Modified: z3c.table/branches/lazyvalues2/src/z3c/table/sort.txt
===================================================================
--- z3c.table/branches/lazyvalues2/src/z3c/table/sort.txt	2010-08-05 09:58:22 UTC (rev 115491)
+++ z3c.table/branches/lazyvalues2/src/z3c/table/sort.txt	2010-08-05 10:11:07 UTC (rev 115492)
@@ -56,6 +56,8 @@
   >>> request = TestRequest()
   >>> sortingTable = SortingTable(container, request)
   >>> sortingTable.update()
+  >>> sortingTable.sortColumn is None
+  True
   >>> print sortingTable.render()
   <table>
     <thead>
@@ -102,6 +104,8 @@
 An important thing is to update the table after set an ``sortOn`` value:
 
   >>> sortingTable.update()
+  >>> sortingTable.sortColumn
+  <NumberColumn u'number'>
   >>> print sortingTable.render()
   <table>
     <thead>

Modified: z3c.table/branches/lazyvalues2/src/z3c/table/table.py
===================================================================
--- z3c.table/branches/lazyvalues2/src/z3c/table/table.py	2010-08-05 09:58:22 UTC (rev 115491)
+++ z3c.table/branches/lazyvalues2/src/z3c/table/table.py	2010-08-05 10:11:07 UTC (rev 115492)
@@ -75,6 +75,7 @@
 
     # sort attributes
     sortOn = 0
+    sortColumn = None
     sortOrder = u'ascending'
     reverseSortOrderNames = [u'descending', u'reverse', u'down']
 
@@ -128,6 +129,8 @@
     def updateColumns(self):
         for col in self.columns:
             col.update()
+            if col.id == self.sortOn:
+                self.sortColumn = col
 
     def orderColumns(self):
         self.columnCounter = 0



More information about the checkins mailing list