首页 > 解决方案 > 是否有一个简单的解决方案来导出过滤的后端列表

问题描述

我有一个包含产品和位置的列表。我创建了一个过滤器定义,可以根据位置过滤产品。现在我想导出过滤后的选择以将其打印为 pdf。

我尝试使用 ajax 框架访问过滤后的项目,但找不到任何有关如何检索过滤后的 id 的信息。

我的 printhandler 工作正常,我只需要在过滤器中获取所选项目的 ID。

范围:

location:
    label: Location
    modelClass: XXX\xxxx\Models\Location
    conditions: location_id in (:filtered)
    nameFrom: location

标签: listfilterwidgetoctobercms

解决方案


与往常一样,在寻求解决方案后找到了解决方案;

找到一段代码:

function getCurrentFilters() {
        $filters = [];
        foreach (\Session::get('widget', []) as $name => $item) {
            if (str_contains($name, 'Filter')) {
                $filter = @unserialize(@base64_decode($item));
                if ($filter) {
                    //$filters[] = $filter;
                    array_push($filters, $filter);
                }
            }
        }

        return $filters;
    }

推荐阅读