Commits

Anonymous committed 08da8fe Merge

Merge Ergo's Grid changes (SQLAlchemy grid helpers).

Comments (0)

Files changed (2)

webhelpers/html/grid.py

         def custem_part_no_td(col_num, i, item):
             return HTML.td(`Foo %s` % item[``part_no``])
         
-        grid.labels[``part_no``] = custem_part_no_td
+        grid.column_formats[``part_no``] = custem_part_no_td
     
     You can customize the grids look and behavior by overloading grids instance
     render functions::
             column_name = "numbered"
         class_name = "c%s %s" % (column_number, column_name)
         return HTML.tag("td", header_label, class_=class_name)
-    
+
+
+class GridSqlalchemy(Grid):
+    """ This grid will work well with sqlalchemy row instances """
+    def default_column_format(self, column_number, i, record, column_name):
+        class_name = "c%s" % (column_number)
+        return HTML.tag("td", getattr(record, column_name), class_=class_name)

webhelpers/pylonslib/grid.py

         else:
             return self.default_header_column_format(column_number, column,
                                                      label_text)
+
+class GridPylonsSqlalchemy(GridPylons):
+    """ This grid will work well with sqlalchemy row instances """
+    def default_column_format(self, column_number, i, record, column_name):
+        class_name = "c%s" % (column_number)
+        return HTML.tag("td", getattr(record, column_name), class_=class_name)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.