dabo Commit
Revision 1526
Date: 2005-11-08 18:01:39 -0800 (Tue, 08 Nov 2005)
Author: paul

Changed:
U   trunk/dabo/lib/datanav/Grid.py
U   trunk/dabo/ui/uiwx/dGrid.py

Log:
Fixed the datanav grid to respect the column type as specified in the
fieldspecs.


Diff:
Modified: trunk/dabo/lib/datanav/Grid.py
===================================================================
--- trunk/dabo/lib/datanav/Grid.py      2005-11-08 17:27:32 UTC (rev 1525)
+++ trunk/dabo/lib/datanav/Grid.py      2005-11-09 02:01:39 UTC (rev 1526)
@@ -46,6 +46,7 @@
                                        columnsToSkip=self.skipFields, 
                                        colOrder=self.colOrders,
                                        colWidths=self.colWidths,
+                                       colTypes=self.colTypes,
                                        autoSizeCols=False):
                                self.built = True
                else:
@@ -189,6 +190,13 @@
                                continue
                        self.colWidths[kk] = int(val[kk]["listColWidth"])
 
+               self.colTypes = {}
+               for kk in val.keys():
+                       if kk in self.skipFields:
+                               continue
+                       self.colTypes[kk] = val[kk]["type"]
+
+
        FieldSpecs = property(_getFldSpecs, _setFldSpecs, None, 
                        _("Holds the fields specs for this form  (dict)") )
 

Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2005-11-08 17:27:32 UTC (rev 1525)
+++ trunk/dabo/ui/uiwx/dGrid.py 2005-11-09 02:01:39 UTC (rev 1526)
@@ -1605,7 +1605,8 @@
 
        
        def buildFromDataSet(self, ds, keyCaption=None, 
-                       columnsToSkip=[], colOrder={}, colWidths={}, 
autoSizeCols=True):
+                       columnsToSkip=[], colOrder={}, colWidths={}, 
colTypes={},
+                       autoSizeCols=True):
                """This method will create a grid for a given data set.
                A 'data set' is a sequence of dicts, each containing field/
                value pairs. The columns will be taken from ds[0].keys(),
@@ -1653,7 +1654,12 @@
                        col = self.addColumn()
                        col.Caption = cap
                        col.DataField = colKey
-                       dt = type(firstRec[colKey])
+
+                       ## pkm: Get the datatype from what is specified in 
fieldspecs, not from
+                       ##      the actual type of the record. 
+                       dt = colTypes[colKey]
+#                      dt = type(firstRec[colKey])
+
                        if dt is type(None):
                                if bizobj:
                                        for idx in range(bizobj.RowCount)[1:]:




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to