Public bug reported:

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?

** Affects: horizon
     Importance: Undecided
         Status: New


** Tags: datatable tabletab

** Tags added: datatable tabletab

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1625061

Title:
  parameters of datatable in tabletab can't store in session

Status in OpenStack Dashboard (Horizon):
  New

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?

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1625061/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to