summaryrefslogtreecommitdiff
path: root/horizon/tables
diff options
context:
space:
mode:
authorGabriel Hurley <gabriel@strikeawe.com>2012-05-22 20:00:43 -0700
committerGabriel Hurley <gabriel@strikeawe.com>2012-05-22 20:00:43 -0700
commite51b9b75ca1f4bacd48daa33fd8e8ec02b9b8236 (patch)
treeded64b66717c9ecfd72d3244cac33b797e70417b /horizon/tables
parentb4fa6ba48990f2f3a5bdc1ac53d835c5b2b95ce6 (diff)
downloadhorizon-e51b9b75ca1f4bacd48daa33fd8e8ec02b9b8236.tar.gz
Adds pagination to Glance API and tables.
Fixes bug 981252. Change-Id: Ib1fa6136947a23521dcdbf6d0d7ae783a6e0fae7
Diffstat (limited to 'horizon/tables')
-rw-r--r--horizon/tables/base.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/horizon/tables/base.py b/horizon/tables/base.py
index 094508c31..db1e7754d 100644
--- a/horizon/tables/base.py
+++ b/horizon/tables/base.py
@@ -563,6 +563,13 @@ class DataTableOptions(object):
The name of the context variable which will contain the table when
it is rendered. Defaults to ``"table"``.
+ .. attribute:: pagination_param
+
+ The name of the query string parameter which will be used when
+ paginating this table. When using multiple tables in a single
+ view this will need to be changed to differentiate between the
+ tables. Default: ``"marker"``.
+
.. attribute:: status_columns
A list or tuple of column names which represents the "state"
@@ -597,6 +604,7 @@ class DataTableOptions(object):
self.row_actions = getattr(options, 'row_actions', [])
self.row_class = getattr(options, 'row_class', Row)
self.column_class = getattr(options, 'column_class', Column)
+ self.pagination_param = getattr(options, 'pagination_param', 'marker')
# Set self.filter if we have any FilterActions
filter_actions = [action for action in self.table_actions if
@@ -1043,6 +1051,10 @@ class DataTable(object):
"""
return http.urlquote_plus(self.get_object_id(self.data[-1]))
+ def get_pagination_string(self):
+ """ Returns the query parameter string to paginate this table. """
+ return "=".join([self._meta.pagination_param, self.get_marker()])
+
def calculate_row_status(self, statuses):
"""
Returns a boolean value determining the overall row status