diff --git a/horizon/browsers/base.py b/horizon/browsers/base.py index 946935c255..4b9193b57e 100644 --- a/horizon/browsers/base.py +++ b/horizon/browsers/base.py @@ -126,8 +126,6 @@ class ResourceBrowser(html.HTMLElement): self.content_table = tables[self.content_table_class._meta.name] navigation_item = self.kwargs.get(self.navigation_kwarg_name) content_path = self.kwargs.get(self.content_kwarg_name) - # Tells the navigation table what is selected. - self.navigation_table.current_item_id = navigation_item if self.has_breadcrumb: self.prepare_breadcrumb(tables, navigation_item, content_path) diff --git a/horizon/browsers/views.py b/horizon/browsers/views.py index 30b6dd8967..46c0b92731 100644 --- a/horizon/browsers/views.py +++ b/horizon/browsers/views.py @@ -41,6 +41,14 @@ class ResourceBrowserView(MultiTableView): ct._no_data_message = _("Select a %s to browse.") % item return browser + def get_tables(self): + tables = super(ResourceBrowserView, self).get_tables() + # Tells the navigation table what is selected. + navigation_table = tables[self.browser_class.navigation_table_class._meta.name] + navigation_item = self.kwargs.get(self.browser_class.navigation_kwarg_name) + navigation_table.current_item_id = navigation_item + return tables + def get_context_data(self, **kwargs): context = super(ResourceBrowserView, self).get_context_data(**kwargs) browser = self.get_browser() diff --git a/horizon/tables/base.py b/horizon/tables/base.py index 4bb3663189..ef16ba94f6 100644 --- a/horizon/tables/base.py +++ b/horizon/tables/base.py @@ -1370,9 +1370,13 @@ class DataTable(object): if table_name == self.name: # Handle AJAX row updating. new_row = self._meta.row_class(self) + if new_row.ajax and new_row.ajax_action_name == action_name: try: datum = new_row.get_data(request, obj_id) + if self.get_object_id(datum) == self.current_item_id: + self.selected = True + new_row.classes.append('current_selected') new_row.load_cells(datum) error = False except Exception: