[Checkins] SVN: z3c.table/trunk/ fix selectedItems and selectedItem, see CHANGES.txt

Roger Ineichen roger at projekt01.ch
Mon Apr 21 11:18:00 EDT 2008


Log message for revision 85531:
  fix selectedItems and selectedItem, see CHANGES.txt

Changed:
  U   z3c.table/trunk/CHANGES.txt
  U   z3c.table/trunk/src/z3c/table/column.py

-=-
Modified: z3c.table/trunk/CHANGES.txt
===================================================================
--- z3c.table/trunk/CHANGES.txt	2008-04-21 13:36:27 UTC (rev 85530)
+++ z3c.table/trunk/CHANGES.txt	2008-04-21 15:17:59 UTC (rev 85531)
@@ -5,8 +5,14 @@
 Version 0.5.1dev (unreleased)
 -----------------------------
 
-- ...
+- Implemented SelectedItemColumn
 
+- Fix CheckBoxColumn, use always the correct selectedItems. Use always real
+  selectedItems form the table
+
+- Fix RadioColumn, use always the correct selectedItem from the selectedItems 
+  list. Use always the first selectedItems form the tables selectedItems
+
 Version 0.5.0 (2008-04-13)
 --------------------------
 

Modified: z3c.table/trunk/src/z3c/table/column.py
===================================================================
--- z3c.table/trunk/src/z3c/table/column.py	2008-04-21 13:36:27 UTC (rev 85530)
+++ z3c.table/trunk/src/z3c/table/column.py	2008-04-21 15:17:59 UTC (rev 85531)
@@ -142,8 +142,17 @@
     """Radio column."""
 
     header = _('X')
-    selectedItem = None
 
+    @apply
+    def selectedItem():
+        # use the items form the table
+        def get(self):
+            if len(self.table.selectedItems):
+                return list(self.table.selectedItems).pop()
+        def set(self, value):
+            self.table.selectedItems = [value]
+        return property(get, set)
+
     def getSortKey(self, item):
         return api.getName(item)
 
@@ -159,7 +168,6 @@
                      self.getItemKey(item), [])]
         if len(items):
             self.selectedItem = items.pop()
-            self.table.selectedItems = [self.selectedItem]
 
     def renderCell(self, item):
         selected = u''
@@ -175,8 +183,16 @@
 
     header = _('X')
     weight = 10
-    selectedItems = []
 
+    @apply
+    def selectedItems():
+        # use the items form the table
+        def get(self):
+            return self.table.selectedItems
+        def set(self, values):
+            self.table.selectedItems = values
+        return property(get, set)
+
     def getSortKey(self, item):
         return api.getName(item)
 
@@ -189,9 +205,7 @@
     def update(self):
         self.selectedItems = [item for item in self.table.values
                               if self.getItemValue(item)
-                              in self.request.get(
-                                self.getItemKey(item), [])]
-        self.table.selectedItems = self.selectedItems
+                              in self.request.get(self.getItemKey(item), [])]
 
     def renderCell(self, item):
         selected = u''



More information about the Checkins mailing list