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

neilcarpenter
neilcarpenter

I want to add a filter to a backend list. But I don't want it to effect the query as such...

The list displays a list of backend users from an Agent model that extends the Backend\Models\User model.

Then I have some columns on my list that are partials...

These partials call some methods on the Agent model. An example of one the partials is below..

<?php foreach ($record->getCommunicationCounts() as $type => $count) : ?>
    <strong><?=ucfirst($type)?>: </strong><?=$count?><br/>
<?php endforeach; ?>

What I want to do is be able to pass some parameters through to these methods based on selections from the list filters. So something like below...

<?php foreach ($record->getCommunicationCounts($this->filters['selectedTimeFrame']) as $type => $count) : ?>
    <strong><?=ucfirst($type)?>: </strong><?=$count?><br/>
<?php endforeach; ?>

So I guess my questions are:-

  1. Can I add filters to backend list that don't affect the list query?
  2. Is there a filter type that is a dropdown and only allows one selection?
  3. Can I access the backend list filter values inside a column partial? And a slightly different question... is there a filter type that's just a dropdown that only allows one selection?
mjauvin
neilcarpenter
neilcarpenter

Yes I have read the docs... Multiple times.

As far as i can tell there's nothing that talks about what I'm trying to do in them unfortunately.

mjauvin
mjauvin

Couldn't find anything either. No dropdown with single select either.

mjauvin
mjauvin

There's one thing that might work, though... you could abuse the list filter scopes by returning the initial query without modifications, BUT save the filter value in the ViewBag component and reuse it in your partial...

1-5 of 5

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