self._spawn_columns()\r
return self._columns.keyOrder.index(name)\r
\r
+ def sortable(self):\r
+ """Iterate through all sortable columns.\r
+\r
+ This is primarily useful in templates, where iterating over the full\r
+ set and checking {% if column.sortable %} can be problematic in\r
+ conjunction with e.g. {{ forloop.last }} (the last column might not\r
+ be the actual last that is rendered).\r
+ """\r
+ for column in self.all():\r
+ if column.sortable:\r
+ yield column\r
+\r
def __iter__(self):\r
"""Iterate through all *visible* bound columns.\r
\r