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

daftspunky
daftspunky

Let's say you want to filter the list by a routing parameter, for example:

This can be acheived by adding this to your Index.php controller:

protected $userId;

public function index($userId = null)
{
    // Store the routed parameter to use later
    $this->userId = $userId;

    // Call the ListController behavior standard functionality
    $this->asExtension('ListController')->index();
}

public function listExtendQuery($query)
{
   // Extend the list query to filter by the user id
    if ($this->userId)
        $query->where('user_id', $this->userId);
}

Last updated

mesinrusak
phplee
phplee

Thanks for this.

I have a checkbox with a delete option on my list. When i delete the $this->listRefresh(); is called and the filter no longer works even though the routes still there.

How can make the filter stay applied after deleting.

thanks

Meysam
Meysam

Awesome! Thank you for the power and flexibility you have provided!

EspinalAnthony
EspinalAnthony

I'm new at OctoberCms, the desire to learn it is huge, I want to know what to do next so I have the list filtered by the id passed by parameter, how do I get it again, and on the index.htm page between php tags use that id to a new query to the BD, my English is not very good

1-5 of 5

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