Winter CMS resources and help articles

Simple and to the point. Optimized by the community.

Get all filtered records by a List Widget

0
by mjauvin, last modified on May 12th, 2021 - Previously published on OctoberTricks

If you want to take an action on all currently filtered records from your Controller implementing the ListController behavior, add this method to your controller:

    public function onGetFilteredRecords()
    {
        $this->makeLists();
        $listWidget = $this->asExtension('ListController')->listGetWidget();

        $query = $listWidget->prepareQuery();
        $records = $query->get();

        // do something with $records
    }

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?