As per my requirement, I need to add a custom grid into a custom tab in the product edit page.
for that, I got one of the good tutorials, but in that, I need to filter the collection by the current product id.
But right now the grid gets the full collection of the custom model.
In that how can I achieve the filter using the current product id?
Updated code in custom_grid_listing.xml
<dataSource name="questionanswer_grid_listing_data_source" component="Magento_Ui/js/grid/provider">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
<item name="filter_url_params" xsi:type="array">
<item name="product_id" xsi:type="string">*</item>
</item>
<item name="update_url" xsi:type="url" path="mui/index/render"/>
<item name="storageConfig" xsi:type="array">
<item name="cacheRequests" xsi:type="boolean">false</item>
</item>
</item>
</argument>
</dataSource>
CustomDataProvider.php
Then i am using below code go get the product_id from the URL, but in URL dont have any product realated infromation
$params = $this->_request->getParams();
$urlInterface = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\UrlInterface');
echo $urlInterface->getCurrentUrl();
echo "<pre>"; print_r($params);
Kindly check the details and share your knowledge.
Thanks in advance for your help and support.