This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

krdr
krdr

I wanted to extend list filter in the fashion that options of one filter depends on selected values in other filter. On the paper, it is easy. Info about particular filter is stored in Session[], all is needed to read it in listFilterExtendQuery(), or that's what I thought. In order to this, OctoberCMS does to calls to listFilterExtendQuery, but session data set in first call can not be read in second call. The only one way is to refresh whole page. My code is like:

 public function listFilterExtendQuery($query,$definition = null,$widget)
 {
    if($definition->scopeName === 'filter2')
    {
        $filter1 = $widget->getScopes()['filter1']->value;

        if(!is_array($filter1)) $filter1= [];

        foreach($filter1 as $key => $filter)
        {
            $filters[] = $key;
        }

        $query->whereIn('filter_1',$filters);
    }
    elseif($definition->scopeName === 'filter1')
    {
        $query->select('status')->distinct()->where('owner_id', '=', $user->id);
    }
}

Last updated

patos
patos

hi, One year later, i guess it's related to this : https://github.com/octobercms/october/issues/1918 I still have the same issue on a fresh install now. Is this issue supposed to be fixed ?

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.