In my dataProvider
class Package\Module\Ui\Component\RsvpDataProvider
in below segment:
<argument name="class" xsi:type="string">Package\Module\Ui\Component\RsvpDataProvider</argument>
I have inherited prepareUpdateUrl
function of \Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider
class like below:
protected function prepareUpdateUrl() {
if (!isset($this->data['config']['filter_url_params'])) {
return;
}
$this->objectManager->get('Psr\Log\LoggerInterface')->critical(print_r($this->data['config']['filter_url_params'], true));
foreach ($this->data['config']['filter_url_params'] as $paramName => $paramValue) {
if ('*' == $paramValue) {
$paramValue = $this->request->getParam($paramName);
}
if ($paramValue) {
$this->data['config']['update_url'] = sprintf(
'%s%s/%s', $this->data['config']['update_url'], $paramName, $paramValue
);
$this->objectManager->get('Psr\Log\LoggerInterface')->critical('$paramName: ' . $paramName . ' $paramValue:' . $paramValue);
if ($paramName == 'status') {
$paramValue = explode(',', $paramValue);
$this->addFilter(
$this->filterBuilder->setField($paramName)->setValue($paramValue)->setConditionType('in')->create()
);
} else {
$this->objectManager->get('Psr\Log\LoggerInterface')->critical('rechead other');
$this->addFilter(
$this->filterBuilder->setField($paramName)->setValue($paramValue)->setConditionType('eq')->create()
);
}
}
}
}
I have customize my code by adding below condition
if ($paramName == 'status')
Definitely this is not the best way to resolve the issue but as I am new to Magento2, I have no other way for resolve the issue.
Please let me know if anyone having better solution/suggestion for this
You can use the below code to pass parameters to any urls:
$param = ['param1' => 'value1', 'param2' => 'value2'];
$resultRedirect->setPath('frontname/path/controllername', ['params' => $params]);
Best Answer
Use below code to Pass parameter