I rephrased my question and got it working (adding filters to a custom grid, that was made with a custom data provider). See question and answer here: Create filterable admin grid from external database table
1 Answer
Ok, I finally found my mistake(?!) - I can get the applied filters in my data-provider php file by using the SessionManagerInterface
:
use Magento\Framework\Session\SessionManagerInterface;
class YourClassname extents AbstractDataProvider
{
protected $session;
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
RequestInterface $request,
UrlInterface $urlBuilder,
Collection $collectionFactory,
FilterBuilder $filterBuilder,
array $meta = [],
array $data = [],
Data $helper,
SessionManagerInterface $session
) {
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
$this->collection = $collectionFactory->load();
$this->helper = $helper;
$this->request = $request;
$this->filterBuilder = $filterBuilder;
$this->urlBuilder = $urlBuilder;
$this->prepareUpdateUrl();
$this->session=$session;
}
public function getData()
{
$this->session->start();
$filters=$this->request->getParam('filters');
}
If anyone faces same problems, feel free to ask.
Some more code from this module and (basically the same) question from me with solution can be found here: Create filterable admin grid from external database table
<filters name="listing_filters"/>
in<listingToolbar />
tag above the<paging name="listing_paging"></paging>
tag in your xml file.