parameters of datatable in tabletab can't store in session

Bug #1625061 reported by markrui
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Invalid
Undecided
Unassigned

Bug Description

When I use datatable in a tabletab, I use filter_type = "server" and filter_choices = (('hostname', _("host name"), True),). Then I can't get the data from table. However, it is just OK in datatable directly in view.
I read about source code and write my filter function as below:
def get_filters(self, filters):
        filter_action = self._tables.items()[0][1]._meta._filter_action
        if filter_action:
            filter_field = self._tables.items()[0][1].get_filter_field()
            if filter_action.is_api_filter(filter_field):
                filter_string = self._tables.items()[0][1].get_filter_string()
                if filter_field and filter_string:
                    filters[filter_field] = filter_string
        return filters

I print the self._tables.items()[0][1] and it is the table instance I need. I print self._tables.items()[0][1].get_filter_field() but it is null. Then I read the source code and find the function is like this:
def get_filter_field(self):
        """Get the filter field value used for 'server' type filters. This
        is the value from the filter action's list of filter choices.
        """
        filter_action = self._meta._filter_action
        param_name = '%s_field' % filter_action.get_param_name()
        filter_field = self.request.session.get(param_name, '')
        return filter_field
I print param_name and it is the field from the website. Then I know filter_field is get from the session according to the code note. I print the session(with __dict__) but it doesn't have a field called '*__q_field'(* is short for my table name), so I wonder if the parameters are stored in session as the code note said.

Can anyone give me any advice?

markrui (markrui)
tags: added: datatable tabletab
markrui (markrui)
summary: - datatable in tabletab can't store in session
+ parameters of datatable in tabletab can't store in session
information type: Public → Public Security
information type: Public Security → Public
Revision history for this message
Gary W. Smith (gary-w-smith) wrote :

Please use the #openstack-horizon IRC channel for help requests (https://wiki.openstack.org/wiki/IRC).

Changed in horizon:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.