Add Custom Grid into a Custom Tab in Product Edit Page collection filter by current product idHow to add Custom Model Grid Into Custom Tab in Product Edit page in admin panel in magento?How can i rewrite TierPrice Block in Magento2Magento 2 Join Product Name To Custom Grid DI Not workingI need to add a custom tab in catalog edit page of admin and need to display a custom grid collection under the tab in magento2.1.1 versionMagento 2.1 Create a filter in the product grid by new attributeHow can Set filter collection in custom model by product id magento 2How can I pass a URL parameter to admin grid data provider?How to render product name in UI component admin grid based off product id in a custom table in Magento 2How to Filter a Custom Column in Product Listing?why admin grid not showing in front end in magento 2

Typesetting a double Over Dot on top of a symbol

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

Why airport relocation isn't done gradually?

Can the Produce Flame cantrip be used to grapple, or as an unarmed strike, in the right circumstances?

Lied on resume at previous job

What do the Banks children have against barley water?

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

What is it called when one voice type sings a 'solo'?

Could a US political party gain complete control over the government by removing checks & balances?

Can I find out the caloric content of bread by dehydrating it?

Need help identifying/translating a plaque in Tangier, Morocco

Are white and non-white police officers equally likely to kill black suspects?

Could Giant Ground Sloths have been a good pack animal for the ancient Mayans?

Why do UK politicians seemingly ignore opinion polls on Brexit?

Does a dangling wire really electrocute me if I'm standing in water?

Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?

Email Account under attack (really) - anything I can do?

"My colleague's body is amazing"

Why is my log file so massive? 22gb. I am running log backups

Does bootstrapped regression allow for inference?

Is there a familial term for apples and pears?

Is ipsum/ipsa/ipse a third person pronoun, or can it serve other functions?

COUNT(*) or MAX(id) - which is faster?

Patience, young "Padovan"



Add Custom Grid into a Custom Tab in Product Edit Page collection filter by current product id


How to add Custom Model Grid Into Custom Tab in Product Edit page in admin panel in magento?How can i rewrite TierPrice Block in Magento2Magento 2 Join Product Name To Custom Grid DI Not workingI need to add a custom tab in catalog edit page of admin and need to display a custom grid collection under the tab in magento2.1.1 versionMagento 2.1 Create a filter in the product grid by new attributeHow can Set filter collection in custom model by product id magento 2How can I pass a URL parameter to admin grid data provider?How to render product name in UI component admin grid based off product id in a custom table in Magento 2How to Filter a Custom Column in Product Listing?why admin grid not showing in front end in magento 2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















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.



http://www.codextblog.com/magento-2/how-to-add-custom-grid-into-a-custom-tab-in-product-edit-page-in-magento-2-admin/



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 = MagentoFrameworkAppObjectManager::getInstance()->get('MagentoFrameworkUrlInterface');
echo $urlInterface->getCurrentUrl();
echo "<pre>"; print_r($params);


enter image description here



Kindly check the details and share your knowledge.



Thanks in advance for your help and support.










share|improve this question






























    0















    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.



    http://www.codextblog.com/magento-2/how-to-add-custom-grid-into-a-custom-tab-in-product-edit-page-in-magento-2-admin/



    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 = MagentoFrameworkAppObjectManager::getInstance()->get('MagentoFrameworkUrlInterface');
    echo $urlInterface->getCurrentUrl();
    echo "<pre>"; print_r($params);


    enter image description here



    Kindly check the details and share your knowledge.



    Thanks in advance for your help and support.










    share|improve this question


























      0












      0








      0








      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.



      http://www.codextblog.com/magento-2/how-to-add-custom-grid-into-a-custom-tab-in-product-edit-page-in-magento-2-admin/



      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 = MagentoFrameworkAppObjectManager::getInstance()->get('MagentoFrameworkUrlInterface');
      echo $urlInterface->getCurrentUrl();
      echo "<pre>"; print_r($params);


      enter image description here



      Kindly check the details and share your knowledge.



      Thanks in advance for your help and support.










      share|improve this question
















      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.



      http://www.codextblog.com/magento-2/how-to-add-custom-grid-into-a-custom-tab-in-product-edit-page-in-magento-2-admin/



      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 = MagentoFrameworkAppObjectManager::getInstance()->get('MagentoFrameworkUrlInterface');
      echo $urlInterface->getCurrentUrl();
      echo "<pre>"; print_r($params);


      enter image description here



      Kindly check the details and share your knowledge.



      Thanks in advance for your help and support.







      magento2 product grid tabs






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 40 secs ago







      senthil

















      asked 12 hours ago









      senthilsenthil

      57911130




      57911130




















          1 Answer
          1






          active

          oldest

          votes


















          0














          Add following code snippet inside custom_grid_listing_data_source tag under settings:




          app/code/Codextblog/Customgridtab/view/adminhtml/ui_component/custom_grid_listing.xml




          <filterUrlParams>
          <param name="product_id">*</param>
          </filterUrlParams>


          Looks like:



          <dataSource name="custom_grid_listing_data_source" component="Magento_Ui/js/grid/provider">
          <settings>
          <filterUrlParams>
          <param name="product_id">*</param>
          </filterUrlParams>
          <updateUrl path="mui/index/render"/>
          </settings>
          ........
          </dataSource>


          In that case, your new table should product_id column exists, otherwise will throw an exception.






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269233%2fadd-custom-grid-into-a-custom-tab-in-product-edit-page-collection-filter-by-curr%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Add following code snippet inside custom_grid_listing_data_source tag under settings:




            app/code/Codextblog/Customgridtab/view/adminhtml/ui_component/custom_grid_listing.xml




            <filterUrlParams>
            <param name="product_id">*</param>
            </filterUrlParams>


            Looks like:



            <dataSource name="custom_grid_listing_data_source" component="Magento_Ui/js/grid/provider">
            <settings>
            <filterUrlParams>
            <param name="product_id">*</param>
            </filterUrlParams>
            <updateUrl path="mui/index/render"/>
            </settings>
            ........
            </dataSource>


            In that case, your new table should product_id column exists, otherwise will throw an exception.






            share|improve this answer



























              0














              Add following code snippet inside custom_grid_listing_data_source tag under settings:




              app/code/Codextblog/Customgridtab/view/adminhtml/ui_component/custom_grid_listing.xml




              <filterUrlParams>
              <param name="product_id">*</param>
              </filterUrlParams>


              Looks like:



              <dataSource name="custom_grid_listing_data_source" component="Magento_Ui/js/grid/provider">
              <settings>
              <filterUrlParams>
              <param name="product_id">*</param>
              </filterUrlParams>
              <updateUrl path="mui/index/render"/>
              </settings>
              ........
              </dataSource>


              In that case, your new table should product_id column exists, otherwise will throw an exception.






              share|improve this answer

























                0












                0








                0







                Add following code snippet inside custom_grid_listing_data_source tag under settings:




                app/code/Codextblog/Customgridtab/view/adminhtml/ui_component/custom_grid_listing.xml




                <filterUrlParams>
                <param name="product_id">*</param>
                </filterUrlParams>


                Looks like:



                <dataSource name="custom_grid_listing_data_source" component="Magento_Ui/js/grid/provider">
                <settings>
                <filterUrlParams>
                <param name="product_id">*</param>
                </filterUrlParams>
                <updateUrl path="mui/index/render"/>
                </settings>
                ........
                </dataSource>


                In that case, your new table should product_id column exists, otherwise will throw an exception.






                share|improve this answer













                Add following code snippet inside custom_grid_listing_data_source tag under settings:




                app/code/Codextblog/Customgridtab/view/adminhtml/ui_component/custom_grid_listing.xml




                <filterUrlParams>
                <param name="product_id">*</param>
                </filterUrlParams>


                Looks like:



                <dataSource name="custom_grid_listing_data_source" component="Magento_Ui/js/grid/provider">
                <settings>
                <filterUrlParams>
                <param name="product_id">*</param>
                </filterUrlParams>
                <updateUrl path="mui/index/render"/>
                </settings>
                ........
                </dataSource>


                In that case, your new table should product_id column exists, otherwise will throw an exception.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 11 hours ago









                Sohel RanaSohel Rana

                23.1k34461




                23.1k34461



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269233%2fadd-custom-grid-into-a-custom-tab-in-product-edit-page-collection-filter-by-curr%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                    Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                    How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2