Jump to content

Select Filter Is Not Working For The New Field Defined In Listingfieldsmodifier Function Of A Module


Recommended Posts

I got a problem in admin listing select filter.

 

I have added a new field from ListingFieldsModifier hook of a module. 

 

'type' => array(
'title' => $this->l('Type'),
'type' => 'select',
'list' => array('one'=>'one','two'=>'two','three'=>'three'),
'filter_key' => 'type'

)

The field is displayed fine in the listing. But filter is not working. I tried to debug core codes why it is not working. I found a function in AdminController

protected function filterToField($key, $filter)
	{
            
		if (!isset($this->fields_list))
			return false;
                
		foreach ($this->fields_list as $field) {
                    
			if (array_key_exists('filter_key', $field) && $field['filter_key'] == $key)
				return $field;
                }
		if (array_key_exists($filter, $this->fields_list))
			return $this->fields_list[$filter];
              
		return false;
	}

It checks whether our fields is in "fields_list" array, if it is not, it returns false. In my case, i have introduce this new field in my custom module with ListingFieldsModifier function. i used the $params['fields'] array to modify the fields list.

 

 

I just tested the core controller by adding this new field, it simply works fine (because it has the new field in "field_list" array.

 

what i have to do now? override the controller to change the fields_list? how to make it work? Please help me with this issue.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...