Get order_id in UI Component GRID in a new Sales View Tabmain.CRITICAL: Plugin class doesn't existMagento 2.1 Create a filter in the product grid by new attributeMagento 2 Add new field to Magento_User admin formMagento offline custom Payment method with drop down listHow to solve Front controller reached 100 router match iterations in magento2I have created one field using product form field for my price i want save my field value at product creation time from backend magento2How to set ui form field value with url-param when loading edit new pageMagento 2.3 Can't view module's front end page output?How to create custom form in Magento 2.2.3Magento 2.3 email attachment not working while sending custom email

show stdout containing n with line breaks

Why do oscilloscopes use SMPS instead of linear power supply?

Write an interpreter for *

How do Mogwai reproduce?

How quickly could a country build a tall concrete wall around a city?

Can we tile the board by L trominos?

Pretty heat maps

I was asked to prove the Principle of Cauchy Induction

During the Space Shuttle Columbia Disaster of 2003, Why Did The Flight Director Say, "Lock the doors."?

Why "ch" pronunciation rule doesn't occur for words such as "durch", "manchmal"?

Why does Intel's Haswell chip allow multiplication to be twice as fast as addition?

How many different ways are there to checkmate in the early game?

Does this Foo machine halt?

Could one become a successful researcher by writing some really good papers while being outside academia?

First amendment and employment: Can an employer terminate you for speech?

Infeasibility in mathematical optimization models

How do I calculate the difference in lens reach between a superzoom compact and a DSLR zoom lens?

What does "sardine box" mean?

How should an administrative assistant reply to student addressing them as "Professor" or "Doctor"?

Dereferencing a pointer in a 'for' loop initializer creates a segmentation fault

What are good ways to improve as a writer other than writing courses?

What is my malfunctioning AI harvesting from humans?

sed delete all the words before a match

Was this a rapid SCHEDULED disassembly? How was it done?



Get order_id in UI Component GRID in a new Sales View Tab


main.CRITICAL: Plugin class doesn't existMagento 2.1 Create a filter in the product grid by new attributeMagento 2 Add new field to Magento_User admin formMagento offline custom Payment method with drop down listHow to solve Front controller reached 100 router match iterations in magento2I have created one field using product form field for my price i want save my field value at product creation time from backend magento2How to set ui form field value with url-param when loading edit new pageMagento 2.3 Can't view module's front end page output?How to create custom form in Magento 2.2.3Magento 2.3 email attachment not working while sending custom email






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








0















After a lot of tries, I couldn't manage to get an order_id to an Admin Grid Data provider.



This is the code I have To add a new tab to order view




view/adminhtml/layout/sales_order_view.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="left">
<referenceBlock name="sales_order_tabs">
<block class="InvoicingMoloniBlockAdminhtmlOrderViewTabDocuments" name="sales_order_documents.grid.container"/>
<action method="addTabAfter">
<argument name="name" xsi:type="string">moloni_documents</argument>
<argument name="block" xsi:type="string">sales_order_documents.grid.container</argument>
<argument name="after" xsi:type="string">order_invoices</argument>
</action>
</referenceBlock>
</referenceContainer>
<referenceBlock name="sales_order_documents.grid.container">
<uiComponent name="orders_documents_grid"/>
</referenceBlock>
</body>
</page>



view/adminhtml/ui_components/orders_documents_grid.xml




<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">orders_documents_grid.orders_documents_grid_data_source</item>
</item>
</argument>
<settings>
<spinner>orders_documents_grid_columns</spinner>
<deps>
<dep>orders_documents_grid.orders_documents_grid_data_source</dep>
</deps>
</settings>
<dataSource name="orders_documents_grid_data_source" component="Magento_Ui/js/grid/provider">
<settings>
<filterUrlParams>
<param name="order_id">*</param>
</filterUrlParams>
<updateUrl path="mui/index/render"/>
</settings>
<dataProvider class="InvoicingMoloniUiDataProviderOrderDocumentsProvider" name="orders_documents_grid_data_source">
<settings>
<requestFieldName>id</requestFieldName>
<primaryFieldName>entity_id</primaryFieldName>
</settings>
</dataProvider>
</dataSource>

<columns name="orders_documents_grid_columns">
<column name="entity_name">
<settings>
<filter>text</filter>
<label translate="true">Nome</label>
</settings>
</column>

<column name="entity_vat">
<settings>
<filter>text</filter>
<label translate="true">Contribuinte</label>
</settings>
</column>
</columns>
</listing>



Ui/DataProvider/OrderDocumentsProvider.php




<?php
/**
* Created by PhpStorm.
* User: Nuno
* Date: 30/07/2019
* Time: 16:20
*/

namespace InvoicingMoloniUiDataProvider;

use InvoicingMoloniLibrariesMoloniLibraryMoloni;
use MagentoUiDataProviderAbstractDataProvider;
use MagentoFrameworkAppRequestHttp;
use MagentoSalesApiOrderRepositoryInterface;

class OrderDocumentsProvider extends AbstractDataProvider

/**
* @var MagentoUiDataProviderAddFieldToCollectionInterface[]
*/
protected $addFieldStrategies;

/**
* @var MagentoUiDataProviderAddFilterToCollectionInterface[]
*/
protected $addFilterStrategies;

/**
* @var Http
*/
protected $request;

/**
* @var OrderRepositoryInterface
*/
protected $orderRepository;

/**
* @var Moloni
*/
private $moloni;

/**
* Construct
*
* @param string $name
* @param string $primaryFieldName
* @param string $requestFieldName
* @param Http $request
* @param array $meta
* @param array $data
*/
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
Http $request,
OrderRepositoryInterface $orderRepository,
Moloni $moloni,
array $meta = [],
array $data = []
)

$this->request = $request;
$this->moloni = $moloni;
$this->orderRepository = $orderRepository;
$this->data = $data;
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);


/**
* @return MagentoSalesApiDataOrderInterface
*/
public function getOrder()

$orderId = $this->request->getParam("order_id");
return $this->orderRepository->get($orderId);


/***
* @return array
*/
public function getData()

$documentsList = [
[
'entity_name' => print_r($this->request->getParams(), true),
'entity_vat' => print_r($this->data, true)
]
];

return [
'totalRecords' => count($documentsList),
'items' => $documentsList,
];


public function setLimit($offset, $size)



public function addOrder($field, $direction)



public function addFilter(MagentoFrameworkApiFilter $filter)





Whenever I try to open the sales order view, all other tabs load the URL like this:



https://magento.retronwarz.com/admin/mui/index/render/key/0d7cba1af800b031dce791267facdc34b5a062f3932738f45e74225339a629e8/order_id/8/?namespace=sales_order_view_invoice_grid


But, when I try to load my tab, the param order_id is not sent, so it looks like:



https://magento.retronwarz.com/admin/mui/index/render/key/0d7cba1af800b031dce791267facdc34b5a062f3932738f45e74225339a629e8/?namespace=orders_documents_grid&isAjax=true


Does anyone know how I can overcome this and send the order_id to the tab URL?



Edit:
For the rest of the code if you want, you can checkout https://github.com/moloni/magento2










share|improve this question
































    0















    After a lot of tries, I couldn't manage to get an order_id to an Admin Grid Data provider.



    This is the code I have To add a new tab to order view




    view/adminhtml/layout/sales_order_view.xml




    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceContainer name="left">
    <referenceBlock name="sales_order_tabs">
    <block class="InvoicingMoloniBlockAdminhtmlOrderViewTabDocuments" name="sales_order_documents.grid.container"/>
    <action method="addTabAfter">
    <argument name="name" xsi:type="string">moloni_documents</argument>
    <argument name="block" xsi:type="string">sales_order_documents.grid.container</argument>
    <argument name="after" xsi:type="string">order_invoices</argument>
    </action>
    </referenceBlock>
    </referenceContainer>
    <referenceBlock name="sales_order_documents.grid.container">
    <uiComponent name="orders_documents_grid"/>
    </referenceBlock>
    </body>
    </page>



    view/adminhtml/ui_components/orders_documents_grid.xml




    <?xml version="1.0" encoding="UTF-8"?>
    <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
    <item name="provider" xsi:type="string">orders_documents_grid.orders_documents_grid_data_source</item>
    </item>
    </argument>
    <settings>
    <spinner>orders_documents_grid_columns</spinner>
    <deps>
    <dep>orders_documents_grid.orders_documents_grid_data_source</dep>
    </deps>
    </settings>
    <dataSource name="orders_documents_grid_data_source" component="Magento_Ui/js/grid/provider">
    <settings>
    <filterUrlParams>
    <param name="order_id">*</param>
    </filterUrlParams>
    <updateUrl path="mui/index/render"/>
    </settings>
    <dataProvider class="InvoicingMoloniUiDataProviderOrderDocumentsProvider" name="orders_documents_grid_data_source">
    <settings>
    <requestFieldName>id</requestFieldName>
    <primaryFieldName>entity_id</primaryFieldName>
    </settings>
    </dataProvider>
    </dataSource>

    <columns name="orders_documents_grid_columns">
    <column name="entity_name">
    <settings>
    <filter>text</filter>
    <label translate="true">Nome</label>
    </settings>
    </column>

    <column name="entity_vat">
    <settings>
    <filter>text</filter>
    <label translate="true">Contribuinte</label>
    </settings>
    </column>
    </columns>
    </listing>



    Ui/DataProvider/OrderDocumentsProvider.php




    <?php
    /**
    * Created by PhpStorm.
    * User: Nuno
    * Date: 30/07/2019
    * Time: 16:20
    */

    namespace InvoicingMoloniUiDataProvider;

    use InvoicingMoloniLibrariesMoloniLibraryMoloni;
    use MagentoUiDataProviderAbstractDataProvider;
    use MagentoFrameworkAppRequestHttp;
    use MagentoSalesApiOrderRepositoryInterface;

    class OrderDocumentsProvider extends AbstractDataProvider

    /**
    * @var MagentoUiDataProviderAddFieldToCollectionInterface[]
    */
    protected $addFieldStrategies;

    /**
    * @var MagentoUiDataProviderAddFilterToCollectionInterface[]
    */
    protected $addFilterStrategies;

    /**
    * @var Http
    */
    protected $request;

    /**
    * @var OrderRepositoryInterface
    */
    protected $orderRepository;

    /**
    * @var Moloni
    */
    private $moloni;

    /**
    * Construct
    *
    * @param string $name
    * @param string $primaryFieldName
    * @param string $requestFieldName
    * @param Http $request
    * @param array $meta
    * @param array $data
    */
    public function __construct(
    $name,
    $primaryFieldName,
    $requestFieldName,
    Http $request,
    OrderRepositoryInterface $orderRepository,
    Moloni $moloni,
    array $meta = [],
    array $data = []
    )

    $this->request = $request;
    $this->moloni = $moloni;
    $this->orderRepository = $orderRepository;
    $this->data = $data;
    parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);


    /**
    * @return MagentoSalesApiDataOrderInterface
    */
    public function getOrder()

    $orderId = $this->request->getParam("order_id");
    return $this->orderRepository->get($orderId);


    /***
    * @return array
    */
    public function getData()

    $documentsList = [
    [
    'entity_name' => print_r($this->request->getParams(), true),
    'entity_vat' => print_r($this->data, true)
    ]
    ];

    return [
    'totalRecords' => count($documentsList),
    'items' => $documentsList,
    ];


    public function setLimit($offset, $size)



    public function addOrder($field, $direction)



    public function addFilter(MagentoFrameworkApiFilter $filter)





    Whenever I try to open the sales order view, all other tabs load the URL like this:



    https://magento.retronwarz.com/admin/mui/index/render/key/0d7cba1af800b031dce791267facdc34b5a062f3932738f45e74225339a629e8/order_id/8/?namespace=sales_order_view_invoice_grid


    But, when I try to load my tab, the param order_id is not sent, so it looks like:



    https://magento.retronwarz.com/admin/mui/index/render/key/0d7cba1af800b031dce791267facdc34b5a062f3932738f45e74225339a629e8/?namespace=orders_documents_grid&isAjax=true


    Does anyone know how I can overcome this and send the order_id to the tab URL?



    Edit:
    For the rest of the code if you want, you can checkout https://github.com/moloni/magento2










    share|improve this question




























      0












      0








      0


      1






      After a lot of tries, I couldn't manage to get an order_id to an Admin Grid Data provider.



      This is the code I have To add a new tab to order view




      view/adminhtml/layout/sales_order_view.xml




      <?xml version="1.0"?>
      <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
      <referenceContainer name="left">
      <referenceBlock name="sales_order_tabs">
      <block class="InvoicingMoloniBlockAdminhtmlOrderViewTabDocuments" name="sales_order_documents.grid.container"/>
      <action method="addTabAfter">
      <argument name="name" xsi:type="string">moloni_documents</argument>
      <argument name="block" xsi:type="string">sales_order_documents.grid.container</argument>
      <argument name="after" xsi:type="string">order_invoices</argument>
      </action>
      </referenceBlock>
      </referenceContainer>
      <referenceBlock name="sales_order_documents.grid.container">
      <uiComponent name="orders_documents_grid"/>
      </referenceBlock>
      </body>
      </page>



      view/adminhtml/ui_components/orders_documents_grid.xml




      <?xml version="1.0" encoding="UTF-8"?>
      <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
      <argument name="data" xsi:type="array">
      <item name="js_config" xsi:type="array">
      <item name="provider" xsi:type="string">orders_documents_grid.orders_documents_grid_data_source</item>
      </item>
      </argument>
      <settings>
      <spinner>orders_documents_grid_columns</spinner>
      <deps>
      <dep>orders_documents_grid.orders_documents_grid_data_source</dep>
      </deps>
      </settings>
      <dataSource name="orders_documents_grid_data_source" component="Magento_Ui/js/grid/provider">
      <settings>
      <filterUrlParams>
      <param name="order_id">*</param>
      </filterUrlParams>
      <updateUrl path="mui/index/render"/>
      </settings>
      <dataProvider class="InvoicingMoloniUiDataProviderOrderDocumentsProvider" name="orders_documents_grid_data_source">
      <settings>
      <requestFieldName>id</requestFieldName>
      <primaryFieldName>entity_id</primaryFieldName>
      </settings>
      </dataProvider>
      </dataSource>

      <columns name="orders_documents_grid_columns">
      <column name="entity_name">
      <settings>
      <filter>text</filter>
      <label translate="true">Nome</label>
      </settings>
      </column>

      <column name="entity_vat">
      <settings>
      <filter>text</filter>
      <label translate="true">Contribuinte</label>
      </settings>
      </column>
      </columns>
      </listing>



      Ui/DataProvider/OrderDocumentsProvider.php




      <?php
      /**
      * Created by PhpStorm.
      * User: Nuno
      * Date: 30/07/2019
      * Time: 16:20
      */

      namespace InvoicingMoloniUiDataProvider;

      use InvoicingMoloniLibrariesMoloniLibraryMoloni;
      use MagentoUiDataProviderAbstractDataProvider;
      use MagentoFrameworkAppRequestHttp;
      use MagentoSalesApiOrderRepositoryInterface;

      class OrderDocumentsProvider extends AbstractDataProvider

      /**
      * @var MagentoUiDataProviderAddFieldToCollectionInterface[]
      */
      protected $addFieldStrategies;

      /**
      * @var MagentoUiDataProviderAddFilterToCollectionInterface[]
      */
      protected $addFilterStrategies;

      /**
      * @var Http
      */
      protected $request;

      /**
      * @var OrderRepositoryInterface
      */
      protected $orderRepository;

      /**
      * @var Moloni
      */
      private $moloni;

      /**
      * Construct
      *
      * @param string $name
      * @param string $primaryFieldName
      * @param string $requestFieldName
      * @param Http $request
      * @param array $meta
      * @param array $data
      */
      public function __construct(
      $name,
      $primaryFieldName,
      $requestFieldName,
      Http $request,
      OrderRepositoryInterface $orderRepository,
      Moloni $moloni,
      array $meta = [],
      array $data = []
      )

      $this->request = $request;
      $this->moloni = $moloni;
      $this->orderRepository = $orderRepository;
      $this->data = $data;
      parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);


      /**
      * @return MagentoSalesApiDataOrderInterface
      */
      public function getOrder()

      $orderId = $this->request->getParam("order_id");
      return $this->orderRepository->get($orderId);


      /***
      * @return array
      */
      public function getData()

      $documentsList = [
      [
      'entity_name' => print_r($this->request->getParams(), true),
      'entity_vat' => print_r($this->data, true)
      ]
      ];

      return [
      'totalRecords' => count($documentsList),
      'items' => $documentsList,
      ];


      public function setLimit($offset, $size)



      public function addOrder($field, $direction)



      public function addFilter(MagentoFrameworkApiFilter $filter)





      Whenever I try to open the sales order view, all other tabs load the URL like this:



      https://magento.retronwarz.com/admin/mui/index/render/key/0d7cba1af800b031dce791267facdc34b5a062f3932738f45e74225339a629e8/order_id/8/?namespace=sales_order_view_invoice_grid


      But, when I try to load my tab, the param order_id is not sent, so it looks like:



      https://magento.retronwarz.com/admin/mui/index/render/key/0d7cba1af800b031dce791267facdc34b5a062f3932738f45e74225339a629e8/?namespace=orders_documents_grid&isAjax=true


      Does anyone know how I can overcome this and send the order_id to the tab URL?



      Edit:
      For the rest of the code if you want, you can checkout https://github.com/moloni/magento2










      share|improve this question
















      After a lot of tries, I couldn't manage to get an order_id to an Admin Grid Data provider.



      This is the code I have To add a new tab to order view




      view/adminhtml/layout/sales_order_view.xml




      <?xml version="1.0"?>
      <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
      <referenceContainer name="left">
      <referenceBlock name="sales_order_tabs">
      <block class="InvoicingMoloniBlockAdminhtmlOrderViewTabDocuments" name="sales_order_documents.grid.container"/>
      <action method="addTabAfter">
      <argument name="name" xsi:type="string">moloni_documents</argument>
      <argument name="block" xsi:type="string">sales_order_documents.grid.container</argument>
      <argument name="after" xsi:type="string">order_invoices</argument>
      </action>
      </referenceBlock>
      </referenceContainer>
      <referenceBlock name="sales_order_documents.grid.container">
      <uiComponent name="orders_documents_grid"/>
      </referenceBlock>
      </body>
      </page>



      view/adminhtml/ui_components/orders_documents_grid.xml




      <?xml version="1.0" encoding="UTF-8"?>
      <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
      <argument name="data" xsi:type="array">
      <item name="js_config" xsi:type="array">
      <item name="provider" xsi:type="string">orders_documents_grid.orders_documents_grid_data_source</item>
      </item>
      </argument>
      <settings>
      <spinner>orders_documents_grid_columns</spinner>
      <deps>
      <dep>orders_documents_grid.orders_documents_grid_data_source</dep>
      </deps>
      </settings>
      <dataSource name="orders_documents_grid_data_source" component="Magento_Ui/js/grid/provider">
      <settings>
      <filterUrlParams>
      <param name="order_id">*</param>
      </filterUrlParams>
      <updateUrl path="mui/index/render"/>
      </settings>
      <dataProvider class="InvoicingMoloniUiDataProviderOrderDocumentsProvider" name="orders_documents_grid_data_source">
      <settings>
      <requestFieldName>id</requestFieldName>
      <primaryFieldName>entity_id</primaryFieldName>
      </settings>
      </dataProvider>
      </dataSource>

      <columns name="orders_documents_grid_columns">
      <column name="entity_name">
      <settings>
      <filter>text</filter>
      <label translate="true">Nome</label>
      </settings>
      </column>

      <column name="entity_vat">
      <settings>
      <filter>text</filter>
      <label translate="true">Contribuinte</label>
      </settings>
      </column>
      </columns>
      </listing>



      Ui/DataProvider/OrderDocumentsProvider.php




      <?php
      /**
      * Created by PhpStorm.
      * User: Nuno
      * Date: 30/07/2019
      * Time: 16:20
      */

      namespace InvoicingMoloniUiDataProvider;

      use InvoicingMoloniLibrariesMoloniLibraryMoloni;
      use MagentoUiDataProviderAbstractDataProvider;
      use MagentoFrameworkAppRequestHttp;
      use MagentoSalesApiOrderRepositoryInterface;

      class OrderDocumentsProvider extends AbstractDataProvider

      /**
      * @var MagentoUiDataProviderAddFieldToCollectionInterface[]
      */
      protected $addFieldStrategies;

      /**
      * @var MagentoUiDataProviderAddFilterToCollectionInterface[]
      */
      protected $addFilterStrategies;

      /**
      * @var Http
      */
      protected $request;

      /**
      * @var OrderRepositoryInterface
      */
      protected $orderRepository;

      /**
      * @var Moloni
      */
      private $moloni;

      /**
      * Construct
      *
      * @param string $name
      * @param string $primaryFieldName
      * @param string $requestFieldName
      * @param Http $request
      * @param array $meta
      * @param array $data
      */
      public function __construct(
      $name,
      $primaryFieldName,
      $requestFieldName,
      Http $request,
      OrderRepositoryInterface $orderRepository,
      Moloni $moloni,
      array $meta = [],
      array $data = []
      )

      $this->request = $request;
      $this->moloni = $moloni;
      $this->orderRepository = $orderRepository;
      $this->data = $data;
      parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);


      /**
      * @return MagentoSalesApiDataOrderInterface
      */
      public function getOrder()

      $orderId = $this->request->getParam("order_id");
      return $this->orderRepository->get($orderId);


      /***
      * @return array
      */
      public function getData()

      $documentsList = [
      [
      'entity_name' => print_r($this->request->getParams(), true),
      'entity_vat' => print_r($this->data, true)
      ]
      ];

      return [
      'totalRecords' => count($documentsList),
      'items' => $documentsList,
      ];


      public function setLimit($offset, $size)



      public function addOrder($field, $direction)



      public function addFilter(MagentoFrameworkApiFilter $filter)





      Whenever I try to open the sales order view, all other tabs load the URL like this:



      https://magento.retronwarz.com/admin/mui/index/render/key/0d7cba1af800b031dce791267facdc34b5a062f3932738f45e74225339a629e8/order_id/8/?namespace=sales_order_view_invoice_grid


      But, when I try to load my tab, the param order_id is not sent, so it looks like:



      https://magento.retronwarz.com/admin/mui/index/render/key/0d7cba1af800b031dce791267facdc34b5a062f3932738f45e74225339a629e8/?namespace=orders_documents_grid&isAjax=true


      Does anyone know how I can overcome this and send the order_id to the tab URL?



      Edit:
      For the rest of the code if you want, you can checkout https://github.com/moloni/magento2







      magento2 grid uicomponent order-grid






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 31 at 7:12









      Raj Mohan R

      1,7973 silver badges13 bronze badges




      1,7973 silver badges13 bronze badges










      asked Jul 30 at 19:28









      Nuno AlmeidaNuno Almeida

      235 bronze badges




      235 bronze badges























          1 Answer
          1






          active

          oldest

          votes


















          1














          Add datasource to di.xml



          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>


          Now looks like:



          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <arguments>
          <argument name="collections" xsi:type="array">
          <item name="moloni_orders_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>
          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelDocumentsGridCollection</item>
          </argument>
          </arguments>
          </type>


          Create app/code/Invoicing/Moloni/Model/ResourceModel/Documents/Grid/Collection.php



          <?php
          namespace InvoicingMoloniModelResourceModelDocumentsGrid;

          use MagentoFrameworkViewElementUiComponentDataProviderSearchResult;
          use MagentoFrameworkDataCollectionDbFetchStrategyInterface as FetchStrategy;
          use MagentoFrameworkDataCollectionEntityFactoryInterface as EntityFactory;
          use MagentoFrameworkEventManagerInterface as EventManager;
          use PsrLogLoggerInterface as Logger;

          class Collection extends SearchResult

          /**
          * Initialize dependencies.
          *
          * @param EntityFactory $entityFactory
          * @param Logger $logger
          * @param FetchStrategy $fetchStrategy
          * @param EventManager $eventManager
          * @param string $mainTable
          * @param string $resourceModel
          */
          public function __construct(
          EntityFactory $entityFactory,
          Logger $logger,
          FetchStrategy $fetchStrategy,
          EventManager $eventManager,
          $mainTable = 'moloni_documents',
          $resourceModel = InvoicingMoloniModelResourceModelDocuments::class
          )
          parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);




          Modify app/code/InvoicingMoloniUiDataProviderOrderDocumentsProvider



          <?php
          /**
          * Created by PhpStorm.
          * User: Nuno
          * Date: 30/07/2019
          * Time: 16:20
          */

          namespace InvoicingMoloniUiDataProvider;

          use InvoicingMoloniLibrariesMoloniLibraryMoloni;
          use MagentoUiDataProviderAbstractDataProvider;
          use MagentoFrameworkAppRequestHttp;
          use MagentoSalesApiOrderRepositoryInterface;
          use MagentoFrameworkViewElementUiComponentDataProviderDataProvider;
          use MagentoFrameworkApiFilterBuilder;
          use MagentoFrameworkApiSearchReportingInterface;
          use MagentoFrameworkApiSearchSearchCriteria;
          use MagentoFrameworkApiSearchSearchCriteriaBuilder;
          use MagentoFrameworkApiSearchSearchResultInterface;
          use MagentoFrameworkAppRequestInterface;

          class OrderDocumentsProvider extends DataProvider

          /**
          * @var MagentoUiDataProviderAddFieldToCollectionInterface[]
          */
          protected $addFieldStrategies;

          /**
          * @var MagentoUiDataProviderAddFilterToCollectionInterface[]
          */
          protected $addFilterStrategies;

          /**
          * @var Http
          */
          protected $request;

          /**
          * @var OrderRepositoryInterface
          */
          protected $orderRepository;

          /**
          * @var Moloni
          */
          private $moloni;

          /**
          * OrderDocumentsProvider constructor.
          *
          * @param string $name
          * @param string $primaryFieldName
          * @param string $requestFieldName
          * @param ReportingInterface $reporting
          * @param SearchCriteriaBuilder $searchCriteriaBuilder
          * @param RequestInterface $request
          * @param FilterBuilder $filterBuilder
          * @param OrderRepositoryInterface $orderRepository
          * @param Moloni $moloni
          * @param array $meta
          * @param array $data
          */
          public function __construct(
          $name,
          $primaryFieldName,
          $requestFieldName,
          ReportingInterface $reporting,
          SearchCriteriaBuilder $searchCriteriaBuilder,
          RequestInterface $request,
          FilterBuilder $filterBuilder,
          OrderRepositoryInterface $orderRepository,
          Moloni $moloni,
          array $meta = [],
          array $data = []
          )

          $this->request = $request;
          $this->moloni = $moloni;
          $this->orderRepository = $orderRepository;
          $this->data = $data;
          parent::__construct($name, $primaryFieldName, $requestFieldName, $reporting, $searchCriteriaBuilder, $request, $filterBuilder, $meta, $data);


          /**
          * @return MagentoSalesApiDataOrderInterface
          */
          public function getOrder()

          $orderId = $this->request->getParam("order_id");
          return $this->orderRepository->get($orderId);


          /***
          * @return array
          */
          public function getData()

          $documentsList = [
          [
          'entity_name' => print_r($this->request->getParams(), true),
          'entity_vat' => print_r($this->data, true)
          ]
          ];

          return [
          'totalRecords' => count($documentsList),
          'items' => $documentsList,
          ];


          public function setLimit($offset, $size)



          public function addOrder($field, $direction)



          public function addFilter(MagentoFrameworkApiFilter $filter)





          Output looks like:
          enter image description here






          share|improve this answer

























          • Amazing! :) That solved my problem and you helped me finish this module! Thank you a lot! :)

            – Nuno Almeida
            Jul 31 at 21:57













          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%2f283847%2fget-order-id-in-ui-component-grid-in-a-new-sales-view-tab%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









          1














          Add datasource to di.xml



          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>


          Now looks like:



          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <arguments>
          <argument name="collections" xsi:type="array">
          <item name="moloni_orders_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>
          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelDocumentsGridCollection</item>
          </argument>
          </arguments>
          </type>


          Create app/code/Invoicing/Moloni/Model/ResourceModel/Documents/Grid/Collection.php



          <?php
          namespace InvoicingMoloniModelResourceModelDocumentsGrid;

          use MagentoFrameworkViewElementUiComponentDataProviderSearchResult;
          use MagentoFrameworkDataCollectionDbFetchStrategyInterface as FetchStrategy;
          use MagentoFrameworkDataCollectionEntityFactoryInterface as EntityFactory;
          use MagentoFrameworkEventManagerInterface as EventManager;
          use PsrLogLoggerInterface as Logger;

          class Collection extends SearchResult

          /**
          * Initialize dependencies.
          *
          * @param EntityFactory $entityFactory
          * @param Logger $logger
          * @param FetchStrategy $fetchStrategy
          * @param EventManager $eventManager
          * @param string $mainTable
          * @param string $resourceModel
          */
          public function __construct(
          EntityFactory $entityFactory,
          Logger $logger,
          FetchStrategy $fetchStrategy,
          EventManager $eventManager,
          $mainTable = 'moloni_documents',
          $resourceModel = InvoicingMoloniModelResourceModelDocuments::class
          )
          parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);




          Modify app/code/InvoicingMoloniUiDataProviderOrderDocumentsProvider



          <?php
          /**
          * Created by PhpStorm.
          * User: Nuno
          * Date: 30/07/2019
          * Time: 16:20
          */

          namespace InvoicingMoloniUiDataProvider;

          use InvoicingMoloniLibrariesMoloniLibraryMoloni;
          use MagentoUiDataProviderAbstractDataProvider;
          use MagentoFrameworkAppRequestHttp;
          use MagentoSalesApiOrderRepositoryInterface;
          use MagentoFrameworkViewElementUiComponentDataProviderDataProvider;
          use MagentoFrameworkApiFilterBuilder;
          use MagentoFrameworkApiSearchReportingInterface;
          use MagentoFrameworkApiSearchSearchCriteria;
          use MagentoFrameworkApiSearchSearchCriteriaBuilder;
          use MagentoFrameworkApiSearchSearchResultInterface;
          use MagentoFrameworkAppRequestInterface;

          class OrderDocumentsProvider extends DataProvider

          /**
          * @var MagentoUiDataProviderAddFieldToCollectionInterface[]
          */
          protected $addFieldStrategies;

          /**
          * @var MagentoUiDataProviderAddFilterToCollectionInterface[]
          */
          protected $addFilterStrategies;

          /**
          * @var Http
          */
          protected $request;

          /**
          * @var OrderRepositoryInterface
          */
          protected $orderRepository;

          /**
          * @var Moloni
          */
          private $moloni;

          /**
          * OrderDocumentsProvider constructor.
          *
          * @param string $name
          * @param string $primaryFieldName
          * @param string $requestFieldName
          * @param ReportingInterface $reporting
          * @param SearchCriteriaBuilder $searchCriteriaBuilder
          * @param RequestInterface $request
          * @param FilterBuilder $filterBuilder
          * @param OrderRepositoryInterface $orderRepository
          * @param Moloni $moloni
          * @param array $meta
          * @param array $data
          */
          public function __construct(
          $name,
          $primaryFieldName,
          $requestFieldName,
          ReportingInterface $reporting,
          SearchCriteriaBuilder $searchCriteriaBuilder,
          RequestInterface $request,
          FilterBuilder $filterBuilder,
          OrderRepositoryInterface $orderRepository,
          Moloni $moloni,
          array $meta = [],
          array $data = []
          )

          $this->request = $request;
          $this->moloni = $moloni;
          $this->orderRepository = $orderRepository;
          $this->data = $data;
          parent::__construct($name, $primaryFieldName, $requestFieldName, $reporting, $searchCriteriaBuilder, $request, $filterBuilder, $meta, $data);


          /**
          * @return MagentoSalesApiDataOrderInterface
          */
          public function getOrder()

          $orderId = $this->request->getParam("order_id");
          return $this->orderRepository->get($orderId);


          /***
          * @return array
          */
          public function getData()

          $documentsList = [
          [
          'entity_name' => print_r($this->request->getParams(), true),
          'entity_vat' => print_r($this->data, true)
          ]
          ];

          return [
          'totalRecords' => count($documentsList),
          'items' => $documentsList,
          ];


          public function setLimit($offset, $size)



          public function addOrder($field, $direction)



          public function addFilter(MagentoFrameworkApiFilter $filter)





          Output looks like:
          enter image description here






          share|improve this answer

























          • Amazing! :) That solved my problem and you helped me finish this module! Thank you a lot! :)

            – Nuno Almeida
            Jul 31 at 21:57















          1














          Add datasource to di.xml



          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>


          Now looks like:



          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <arguments>
          <argument name="collections" xsi:type="array">
          <item name="moloni_orders_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>
          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelDocumentsGridCollection</item>
          </argument>
          </arguments>
          </type>


          Create app/code/Invoicing/Moloni/Model/ResourceModel/Documents/Grid/Collection.php



          <?php
          namespace InvoicingMoloniModelResourceModelDocumentsGrid;

          use MagentoFrameworkViewElementUiComponentDataProviderSearchResult;
          use MagentoFrameworkDataCollectionDbFetchStrategyInterface as FetchStrategy;
          use MagentoFrameworkDataCollectionEntityFactoryInterface as EntityFactory;
          use MagentoFrameworkEventManagerInterface as EventManager;
          use PsrLogLoggerInterface as Logger;

          class Collection extends SearchResult

          /**
          * Initialize dependencies.
          *
          * @param EntityFactory $entityFactory
          * @param Logger $logger
          * @param FetchStrategy $fetchStrategy
          * @param EventManager $eventManager
          * @param string $mainTable
          * @param string $resourceModel
          */
          public function __construct(
          EntityFactory $entityFactory,
          Logger $logger,
          FetchStrategy $fetchStrategy,
          EventManager $eventManager,
          $mainTable = 'moloni_documents',
          $resourceModel = InvoicingMoloniModelResourceModelDocuments::class
          )
          parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);




          Modify app/code/InvoicingMoloniUiDataProviderOrderDocumentsProvider



          <?php
          /**
          * Created by PhpStorm.
          * User: Nuno
          * Date: 30/07/2019
          * Time: 16:20
          */

          namespace InvoicingMoloniUiDataProvider;

          use InvoicingMoloniLibrariesMoloniLibraryMoloni;
          use MagentoUiDataProviderAbstractDataProvider;
          use MagentoFrameworkAppRequestHttp;
          use MagentoSalesApiOrderRepositoryInterface;
          use MagentoFrameworkViewElementUiComponentDataProviderDataProvider;
          use MagentoFrameworkApiFilterBuilder;
          use MagentoFrameworkApiSearchReportingInterface;
          use MagentoFrameworkApiSearchSearchCriteria;
          use MagentoFrameworkApiSearchSearchCriteriaBuilder;
          use MagentoFrameworkApiSearchSearchResultInterface;
          use MagentoFrameworkAppRequestInterface;

          class OrderDocumentsProvider extends DataProvider

          /**
          * @var MagentoUiDataProviderAddFieldToCollectionInterface[]
          */
          protected $addFieldStrategies;

          /**
          * @var MagentoUiDataProviderAddFilterToCollectionInterface[]
          */
          protected $addFilterStrategies;

          /**
          * @var Http
          */
          protected $request;

          /**
          * @var OrderRepositoryInterface
          */
          protected $orderRepository;

          /**
          * @var Moloni
          */
          private $moloni;

          /**
          * OrderDocumentsProvider constructor.
          *
          * @param string $name
          * @param string $primaryFieldName
          * @param string $requestFieldName
          * @param ReportingInterface $reporting
          * @param SearchCriteriaBuilder $searchCriteriaBuilder
          * @param RequestInterface $request
          * @param FilterBuilder $filterBuilder
          * @param OrderRepositoryInterface $orderRepository
          * @param Moloni $moloni
          * @param array $meta
          * @param array $data
          */
          public function __construct(
          $name,
          $primaryFieldName,
          $requestFieldName,
          ReportingInterface $reporting,
          SearchCriteriaBuilder $searchCriteriaBuilder,
          RequestInterface $request,
          FilterBuilder $filterBuilder,
          OrderRepositoryInterface $orderRepository,
          Moloni $moloni,
          array $meta = [],
          array $data = []
          )

          $this->request = $request;
          $this->moloni = $moloni;
          $this->orderRepository = $orderRepository;
          $this->data = $data;
          parent::__construct($name, $primaryFieldName, $requestFieldName, $reporting, $searchCriteriaBuilder, $request, $filterBuilder, $meta, $data);


          /**
          * @return MagentoSalesApiDataOrderInterface
          */
          public function getOrder()

          $orderId = $this->request->getParam("order_id");
          return $this->orderRepository->get($orderId);


          /***
          * @return array
          */
          public function getData()

          $documentsList = [
          [
          'entity_name' => print_r($this->request->getParams(), true),
          'entity_vat' => print_r($this->data, true)
          ]
          ];

          return [
          'totalRecords' => count($documentsList),
          'items' => $documentsList,
          ];


          public function setLimit($offset, $size)



          public function addOrder($field, $direction)



          public function addFilter(MagentoFrameworkApiFilter $filter)





          Output looks like:
          enter image description here






          share|improve this answer

























          • Amazing! :) That solved my problem and you helped me finish this module! Thank you a lot! :)

            – Nuno Almeida
            Jul 31 at 21:57













          1












          1








          1







          Add datasource to di.xml



          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>


          Now looks like:



          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <arguments>
          <argument name="collections" xsi:type="array">
          <item name="moloni_orders_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>
          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelDocumentsGridCollection</item>
          </argument>
          </arguments>
          </type>


          Create app/code/Invoicing/Moloni/Model/ResourceModel/Documents/Grid/Collection.php



          <?php
          namespace InvoicingMoloniModelResourceModelDocumentsGrid;

          use MagentoFrameworkViewElementUiComponentDataProviderSearchResult;
          use MagentoFrameworkDataCollectionDbFetchStrategyInterface as FetchStrategy;
          use MagentoFrameworkDataCollectionEntityFactoryInterface as EntityFactory;
          use MagentoFrameworkEventManagerInterface as EventManager;
          use PsrLogLoggerInterface as Logger;

          class Collection extends SearchResult

          /**
          * Initialize dependencies.
          *
          * @param EntityFactory $entityFactory
          * @param Logger $logger
          * @param FetchStrategy $fetchStrategy
          * @param EventManager $eventManager
          * @param string $mainTable
          * @param string $resourceModel
          */
          public function __construct(
          EntityFactory $entityFactory,
          Logger $logger,
          FetchStrategy $fetchStrategy,
          EventManager $eventManager,
          $mainTable = 'moloni_documents',
          $resourceModel = InvoicingMoloniModelResourceModelDocuments::class
          )
          parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);




          Modify app/code/InvoicingMoloniUiDataProviderOrderDocumentsProvider



          <?php
          /**
          * Created by PhpStorm.
          * User: Nuno
          * Date: 30/07/2019
          * Time: 16:20
          */

          namespace InvoicingMoloniUiDataProvider;

          use InvoicingMoloniLibrariesMoloniLibraryMoloni;
          use MagentoUiDataProviderAbstractDataProvider;
          use MagentoFrameworkAppRequestHttp;
          use MagentoSalesApiOrderRepositoryInterface;
          use MagentoFrameworkViewElementUiComponentDataProviderDataProvider;
          use MagentoFrameworkApiFilterBuilder;
          use MagentoFrameworkApiSearchReportingInterface;
          use MagentoFrameworkApiSearchSearchCriteria;
          use MagentoFrameworkApiSearchSearchCriteriaBuilder;
          use MagentoFrameworkApiSearchSearchResultInterface;
          use MagentoFrameworkAppRequestInterface;

          class OrderDocumentsProvider extends DataProvider

          /**
          * @var MagentoUiDataProviderAddFieldToCollectionInterface[]
          */
          protected $addFieldStrategies;

          /**
          * @var MagentoUiDataProviderAddFilterToCollectionInterface[]
          */
          protected $addFilterStrategies;

          /**
          * @var Http
          */
          protected $request;

          /**
          * @var OrderRepositoryInterface
          */
          protected $orderRepository;

          /**
          * @var Moloni
          */
          private $moloni;

          /**
          * OrderDocumentsProvider constructor.
          *
          * @param string $name
          * @param string $primaryFieldName
          * @param string $requestFieldName
          * @param ReportingInterface $reporting
          * @param SearchCriteriaBuilder $searchCriteriaBuilder
          * @param RequestInterface $request
          * @param FilterBuilder $filterBuilder
          * @param OrderRepositoryInterface $orderRepository
          * @param Moloni $moloni
          * @param array $meta
          * @param array $data
          */
          public function __construct(
          $name,
          $primaryFieldName,
          $requestFieldName,
          ReportingInterface $reporting,
          SearchCriteriaBuilder $searchCriteriaBuilder,
          RequestInterface $request,
          FilterBuilder $filterBuilder,
          OrderRepositoryInterface $orderRepository,
          Moloni $moloni,
          array $meta = [],
          array $data = []
          )

          $this->request = $request;
          $this->moloni = $moloni;
          $this->orderRepository = $orderRepository;
          $this->data = $data;
          parent::__construct($name, $primaryFieldName, $requestFieldName, $reporting, $searchCriteriaBuilder, $request, $filterBuilder, $meta, $data);


          /**
          * @return MagentoSalesApiDataOrderInterface
          */
          public function getOrder()

          $orderId = $this->request->getParam("order_id");
          return $this->orderRepository->get($orderId);


          /***
          * @return array
          */
          public function getData()

          $documentsList = [
          [
          'entity_name' => print_r($this->request->getParams(), true),
          'entity_vat' => print_r($this->data, true)
          ]
          ];

          return [
          'totalRecords' => count($documentsList),
          'items' => $documentsList,
          ];


          public function setLimit($offset, $size)



          public function addOrder($field, $direction)



          public function addFilter(MagentoFrameworkApiFilter $filter)





          Output looks like:
          enter image description here






          share|improve this answer













          Add datasource to di.xml



          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>


          Now looks like:



          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <arguments>
          <argument name="collections" xsi:type="array">
          <item name="moloni_orders_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelOrdersCollection</item>
          <item name="sales_order_view_document_grid_data_source" xsi:type="string">InvoicingMoloniModelResourceModelDocumentsGridCollection</item>
          </argument>
          </arguments>
          </type>


          Create app/code/Invoicing/Moloni/Model/ResourceModel/Documents/Grid/Collection.php



          <?php
          namespace InvoicingMoloniModelResourceModelDocumentsGrid;

          use MagentoFrameworkViewElementUiComponentDataProviderSearchResult;
          use MagentoFrameworkDataCollectionDbFetchStrategyInterface as FetchStrategy;
          use MagentoFrameworkDataCollectionEntityFactoryInterface as EntityFactory;
          use MagentoFrameworkEventManagerInterface as EventManager;
          use PsrLogLoggerInterface as Logger;

          class Collection extends SearchResult

          /**
          * Initialize dependencies.
          *
          * @param EntityFactory $entityFactory
          * @param Logger $logger
          * @param FetchStrategy $fetchStrategy
          * @param EventManager $eventManager
          * @param string $mainTable
          * @param string $resourceModel
          */
          public function __construct(
          EntityFactory $entityFactory,
          Logger $logger,
          FetchStrategy $fetchStrategy,
          EventManager $eventManager,
          $mainTable = 'moloni_documents',
          $resourceModel = InvoicingMoloniModelResourceModelDocuments::class
          )
          parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);




          Modify app/code/InvoicingMoloniUiDataProviderOrderDocumentsProvider



          <?php
          /**
          * Created by PhpStorm.
          * User: Nuno
          * Date: 30/07/2019
          * Time: 16:20
          */

          namespace InvoicingMoloniUiDataProvider;

          use InvoicingMoloniLibrariesMoloniLibraryMoloni;
          use MagentoUiDataProviderAbstractDataProvider;
          use MagentoFrameworkAppRequestHttp;
          use MagentoSalesApiOrderRepositoryInterface;
          use MagentoFrameworkViewElementUiComponentDataProviderDataProvider;
          use MagentoFrameworkApiFilterBuilder;
          use MagentoFrameworkApiSearchReportingInterface;
          use MagentoFrameworkApiSearchSearchCriteria;
          use MagentoFrameworkApiSearchSearchCriteriaBuilder;
          use MagentoFrameworkApiSearchSearchResultInterface;
          use MagentoFrameworkAppRequestInterface;

          class OrderDocumentsProvider extends DataProvider

          /**
          * @var MagentoUiDataProviderAddFieldToCollectionInterface[]
          */
          protected $addFieldStrategies;

          /**
          * @var MagentoUiDataProviderAddFilterToCollectionInterface[]
          */
          protected $addFilterStrategies;

          /**
          * @var Http
          */
          protected $request;

          /**
          * @var OrderRepositoryInterface
          */
          protected $orderRepository;

          /**
          * @var Moloni
          */
          private $moloni;

          /**
          * OrderDocumentsProvider constructor.
          *
          * @param string $name
          * @param string $primaryFieldName
          * @param string $requestFieldName
          * @param ReportingInterface $reporting
          * @param SearchCriteriaBuilder $searchCriteriaBuilder
          * @param RequestInterface $request
          * @param FilterBuilder $filterBuilder
          * @param OrderRepositoryInterface $orderRepository
          * @param Moloni $moloni
          * @param array $meta
          * @param array $data
          */
          public function __construct(
          $name,
          $primaryFieldName,
          $requestFieldName,
          ReportingInterface $reporting,
          SearchCriteriaBuilder $searchCriteriaBuilder,
          RequestInterface $request,
          FilterBuilder $filterBuilder,
          OrderRepositoryInterface $orderRepository,
          Moloni $moloni,
          array $meta = [],
          array $data = []
          )

          $this->request = $request;
          $this->moloni = $moloni;
          $this->orderRepository = $orderRepository;
          $this->data = $data;
          parent::__construct($name, $primaryFieldName, $requestFieldName, $reporting, $searchCriteriaBuilder, $request, $filterBuilder, $meta, $data);


          /**
          * @return MagentoSalesApiDataOrderInterface
          */
          public function getOrder()

          $orderId = $this->request->getParam("order_id");
          return $this->orderRepository->get($orderId);


          /***
          * @return array
          */
          public function getData()

          $documentsList = [
          [
          'entity_name' => print_r($this->request->getParams(), true),
          'entity_vat' => print_r($this->data, true)
          ]
          ];

          return [
          'totalRecords' => count($documentsList),
          'items' => $documentsList,
          ];


          public function setLimit($offset, $size)



          public function addOrder($field, $direction)



          public function addFilter(MagentoFrameworkApiFilter $filter)





          Output looks like:
          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 31 at 7:54









          Sohel RanaSohel Rana

          25.9k3 gold badges48 silver badges66 bronze badges




          25.9k3 gold badges48 silver badges66 bronze badges















          • Amazing! :) That solved my problem and you helped me finish this module! Thank you a lot! :)

            – Nuno Almeida
            Jul 31 at 21:57

















          • Amazing! :) That solved my problem and you helped me finish this module! Thank you a lot! :)

            – Nuno Almeida
            Jul 31 at 21:57
















          Amazing! :) That solved my problem and you helped me finish this module! Thank you a lot! :)

          – Nuno Almeida
          Jul 31 at 21:57





          Amazing! :) That solved my problem and you helped me finish this module! Thank you a lot! :)

          – Nuno Almeida
          Jul 31 at 21:57

















          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%2f283847%2fget-order-id-in-ui-component-grid-in-a-new-sales-view-tab%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

          Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

          Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

          Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림