I am trying to get request param id when edit page in my component dataprovider file. But getting always null value in it.
I am rendering grid in product edit page and i need to filter my data based on current edit page.and when i try to click on tab it fire mui/index/render action and not getting product id in it.
I have also tried using this code (int)$this->request->getParam('current_product_id'); but it is also returning empty value. can anyone please guide on this.
even in registry not availabe.
Replace the below code in the custom modifier class' array of config.
'imports' => [ 'productId' => '${ $.provider }:data.product.current_product_id', '__disableTmpl' => ['productId' => false], ], 'exports' => [ 'productId' => '${ $.externalProvider }:params.current_product_id', '__disableTmpl' => ['productId' => false], ],
namespace Namespace\Module\Ui\DataProvider\Product; use Magento\Framework\App\RequestInterface; use Magento\Ui\DataProvider\AbstractDataProvider; class QuestionAnswerDataProvider extends AbstractDataProvider { protected $request; public function __construct( RequestInterface $request, ) { $this->request = $request; } public function getData() { echo $this->request->getParam('current_product_id); } }