Magento 2 Load UI grid only after filter search

I have created custom module. In that I am displaying product collection in Ui grid. I have extend \Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider to display collections.

What is my requirement : I want to display(load) collection only after user search anything from filter.

The UI grid should not display any product until user search anything from filter.

My code For this file app/code/Company/module/Ui/DataProvider/Product/Vendor/ProductDataProvider.php

<?php /**  * Copyright © 2015 Magento. All rights reserved.  * See COPYING.txt for license details.  */ namespace Company\module\Ui\DataProvider\Product\Vendor;  use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;  /**  * Class ProductDataProvider  */ class ProductDataProvider extends \Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider {      /**      * Construct      *      * @param string $  name      * @param string $  primaryFieldName      * @param string $  requestFieldName      * @param CollectionFactory $  collectionFactory      * @param \Magento\Ui\DataProvider\AddFieldToCollectionInterface[] $  addFieldStrategies      * @param \Magento\Ui\DataProvider\AddFilterToCollectionInterface[] $  addFilterStrategies      * @param array $  meta      * @param array $  data      */     public function __construct(         $  name,         $  primaryFieldName,         $  requestFieldName,         CollectionFactory $  collectionFactory,         array $  addFieldStrategies = [],         array $  addFilterStrategies = [],         array $  meta = [],         array $  data = []     ) {         parent::__construct($  name, $  primaryFieldName, $  requestFieldName, $  collectionFactory, $  addFieldStrategies, $  addFilterStrategies, $  meta, $  data);         $  this->collection->addAttributeToFilter('type_id', 'configurable');         $  this->collection->addAttributeToFilter('has_options', '1');         $  this->collection->joinField(             'qty',             'cataloginventory_stock_item',             'qty',             'product_id=entity_id',             '{{table}}.stock_id=1',             'left'         );     } } 

i want all order attachment to print once i “print all” with the invoice in magento sales grid

On the Magento sales grid, there is a dropdown tab that says “Print All”. When I select this, not only do I want the order invoice to print, I also want all the order attachments to print. The order attachments are uploaded using the default Magento custom product functionality as either jpg or pdf files. Please i would be very greatful if you can help me out with the code or solution.

Use join table to display data in admin grid column

How can I use join table to display second table data in admin grid? Admin grid is created using layout & block in proper manner.

I used this link (how to create a grid without using ui component in magento 2) as reference.

Using below code I display data

<block class="Magento\Backend\Block\Widget\Grid\Column" name="recipient_email">                     <arguments>                         <argument name="header" xsi:type="string" translate="true">Recipient Email</argument>                         <argument name="index" xsi:type="string">recipient_email</argument>                         <argument name="renderer" xsi:type="string">Comapny\Module\Block\Adminhtml\Widget\Grid\Column\Renderer\Recipientemail</argument>                  </block> 

But issue while searching & sorting

I am using this for overriding the default module of enterprise (gift card account)

Issue with edit Option in Action column admin grid

While Creating the admin grid the action column remains empty and the Edit option is not visible. How to resolve this issue.

This is my Ui_Component file (action section)

<actionsColumn name="action"   class="Naiwrita\Boral\Ui\Component\Listing\Column\Action">            <argument name="data" xsi:type="array">                <item name="config" xsi:type="array">                    <item name="resizeEnabled" xsi:type="boolean">true</item>                    <item name="resizeDefaultWidth" xsi:type="string">107</item>                    <item name="indexField" xsi:type="string">id</item>                </item>            </argument>        </actionsColumn> 

This is the action.php file where the edit option is implemented

class Action extends Column {     const ROW_EDIT_URL = 'sample/index/addrow';     protected $  _urlBuilder;     private $  _editUrl;     public function __construct(         ContextInterface $  context,         UiComponentFactory $  uiComponentFactory,         UrlInterface $  urlBuilder,         array $  components = [],         array $  data = [],         $  editUrl = self::ROW_EDIT_URL)      {         $  this->_urlBuilder = $  urlBuilder;         $  this->_editUrl = $  editUrl;         parent::__construct($  context, $  uiComponentFactory, $  components, $  data);     }     public function prepareDataSource(array $  dataSource)     {         if (isset($  dataSource['data']['items'])) {             foreach ($  dataSource['data']['items'] as &$  item) {                 $  name = $  this->getData('name');                 if (isset($  item['id'])) {                    $  item[$  name]['edit'] = [                         'href' => $  this->_urlBuilder->getUrl($  this->_editUrl,  ['id' => $  item['id']]),                         'label' => __('Edit'),                     ];                 }             }         }return $  dataSource;     } } 

same row content repeat in the whole page grid while navigate pagination

enter image description hereThe problem :

When you apply filter or pagination, then removing filter, same row content being repeat in the whole page grid. Here is the file where I am making mistakes?

<?xml version="1.0" encoding="UTF-8"?> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:noNamespaceSchemaLocation="../../../../../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">replacement_member_listing.replacement_member_listing_data_source</item>             <item name="deps" xsi:type="string">replacement_member_listing.replacement_member_listing_data_source</item>         </item>         <item name="spinner" xsi:type="string">replacement_member_listing_columns</item>     </argument>         <dataSource name="replacement_member_listing_data_source">         <argument name="dataProvider" xsi:type="configurableObject">             <argument name="name" xsi:type="string">replacement_member_listing_data_source</argument>             <argument name="class" xsi:type="string">Aayanshtech\Replacement\Ui\DataProvider\MemberDataProvider</argument>             <argument name="primaryFieldName" xsi:type="string">w_id</argument>             <argument name="requestFieldName" xsi:type="string">id</argument>             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="update_url" xsi:type="url" path="mui/index/render" />                  </item>                <item name="storageConfig" xsi:type="array">                      <item name="indexField" xsi:type="string">w_id</item>                 </item>             </argument>         </argument>         <argument name="data" xsi:type="array">             <item name="js_config" xsi:type="array">                 <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>             </item>         </argument>             </dataSource>         <container name="listing_top">         <argument name="data" xsi:type="array">             <item name="config" xsi:type="array">                 <item name="template" xsi:type="string">ui/grid/toolbar</item>             </item>         </argument>         <bookmark name="bookmarks">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/bookmarks/bookmarks</item>                     <item name="displayArea" xsi:type="string">dataGridAcions</item>                     <item name="storageConfig" xsi:type="array">                         <item name="saveUrl" xsi:type="url" path="mui/bookmark/save"/>                         <item name="deleteUrl" xsi:type="url" path="mui/bookmark/delete"/>                         <item name="namespace" xsi:type="string">replacement_member_listing</item>                     </item>                 </item>             </argument>         </bookmark>                <filters name="listing_filters">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="displayArea" xsi:type="string">dataGridFilters</item>                     <item name="dataScope" xsi:type="string">filters</item>                     <item name="storageConfig" xsi:type="array">                         <item name="provider" xsi:type="string">replacement_member_listing.replacement_member_listing.listing_top.bookmarks</item>                         <item name="namespace" xsi:type="string">current.filters</item>                     </item>                     <item name="childDefaults" xsi:type="array">                         <item name="provider" xsi:type="string">replacement_member_listing.replacement_member_listing.listing_top.listing_filters</item>                         <item name="imports" xsi:type="array">                             <item name="visible" xsi:type="string">replacement_member_listing.replacement_member_listing.replacement_member_listing_columns.$  { $  .index }:visible</item>                         </item>                     </item>                 </item>             </argument>             <filterInput name="order_number">                 <argument name="data" xsi:type="array">                     <item name="config" xsi:type="array">                         <item name="dataScope" xsi:type="string">order_number</item>                         <item name="label" xsi:type="string" translate="true">Order Number</item>                     </item>                 </argument>             </filterInput>              <filterInput name="first_name">                 <argument name="data" xsi:type="array">                     <item name="config" xsi:type="array">                         <item name="dataScope" xsi:type="string">first_name</item>                         <item name="label" xsi:type="string" translate="true">First Name</item>                     </item>                 </argument>             </filterInput>               <filterInput name="email">                 <argument name="data" xsi:type="array">                     <item name="config" xsi:type="array">                         <item name="dataScope" xsi:type="string">email</item>                         <item name="label" xsi:type="string" translate="true">Email</item>                     </item>                 </argument>             </filterInput>         </filters>            <massaction name="listing_massaction">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                       <item name="selectProvider" xsi:type="string">replacement_member_listing.replacement_member_listing.replacement_member_listing_columns.ids</item>                     <item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>                     <item name="indexField" xsi:type="string">w_id</item>                 </item>             </argument>             <!-- Mass actions which you want to add in your grid-->             <action name="delete">                 <argument name="data" xsi:type="array">                     <item name="config" xsi:type="array">                         <item name="type" xsi:type="string">delete</item>                         <item name="label" xsi:type="string" translate="true">Delete</item>                         <item name="url" xsi:type="url" path="replacement/grid/massdelete"/>                         <item name="confirm" xsi:type="array">                             <item name="title" xsi:type="string" translate="true">Delete</item>                             <item name="message" xsi:type="string" translate="true">Do you want to delete selected row record?</item>                         </item>                     </item>                 </argument>             </action>             <action name="massemail">                 <argument name="data" xsi:type="array">                     <item name="config" xsi:type="array">                         <item name="type" xsi:type="string">massemail</item>                         <item name="label" xsi:type="string" translate="true">Send E-Mails</item>                         <item name="url" xsi:type="url" path="replacement/grid/massemail"/>                                            </item>                 </argument>             </action>         </massaction>          <paging name="listing_paging">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="storageConfig" xsi:type="array">                         <item name="provider" xsi:type="string">replacement_member_listing.replacement_member_listing.listing_top.bookmarks</item>                         <item name="namespace" xsi:type="string">current.paging</item>                     </item>                     <item name="selectProvider" xsi:type="string">replacement_member_listing.replacement_member_listing.replacement_records_columns.ids</item>                 </item>             </argument>         </paging>     </container>         <columns name="replacement_member_listing_columns">         <argument name="data" xsi:type="array">             <item name="config" xsi:type="array">                 <item name="storageConfig" xsi:type="array">                     <item name="provider" xsi:type="string">replacement_member_listing.replacement_member_listing.listing_top.bookmarks</item>                     <item name="namespace" xsi:type="string">current</item>                 </item>                   <item name="editorConfig" xsi:type="array">                     <item name="selectProvider" xsi:type="string">replacement_member_listing.replacement_member_listing.replacement_member_listing_columns.ids</item>                     <item name="enabled" xsi:type="boolean">true</item>                     <item name="indexField" xsi:type="string">w_id</item>                     <item name="clientConfig" xsi:type="array">                         <item name="saveUrl" xsi:type="url" path="replacement/index/InlineEdit"/>                         <item name="validateBeforeSave" xsi:type="boolean">false</item>                     </item>                 </item>                  <item name="childDefaults" xsi:type="array">                     <item name="fieldAction" xsi:type="array">                         <item name="provider" xsi:type="string">replacement_member_listing.replacement_member_listing.replacement_member_listing_columns_editor</item>                         <item name="target" xsi:type="string">startEdit</item>                         <item name="params" xsi:type="array">                             <item name="0" xsi:type="string">$  { $  .$  data.rowIndex }</item>                             <item name="1" xsi:type="boolean">true</item>                         </item>                     </item>                     <item name="storageConfig" xsi:type="array">                         <item name="provider" xsi:type="string">replacement_member_listing.replacement_member_listing.replacement_member_listing.listing_top.bookmarks</item>                         <item name="root" xsi:type="string">columns.$  { $  .index }</item>                         <item name="namespace" xsi:type="string">current.$  { $  .storageConfig.root }</item>                     </item>                 </item>             </item>         </argument>         <selectionsColumn name="ids">             <argument name="data" xsi:type="array">                 <item name="config" xsi:type="array">                     <item name="resizeEnabled" xsi:type="boolean">false</item>                     <item name="resizeDefaultWidth" xsi:type="string">55</item>                     <item name="indexField" xsi:type="string">w_id</item>                 </item>             </argument>         </selectionsColumn>           <column name="w_id">            <argument name="data" xsi:type="array">                <item name="config" xsi:type="array">                    <item name="filter" xsi:type="string">number</item>            <item name="sorting" xsi:type="string">desc</item>                    <item name="label" xsi:type="string" translate="true">Id</item>                </item>            </argument>        </column>         <column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date" >            <argument name="data" xsi:type="array">                <item name="config" xsi:type="array">                    <item name="filter" xsi:type="string">dateRange</item>                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>                    <item name="dataType" xsi:type="string">date</item>                    <item name="label" xsi:type="string" translate="true">Created At</item>                </item>            </argument>        </column>     <column name="order_number">            <argument name="data" xsi:type="array">                <item name="config" xsi:type="array">                    <item name="filter" xsi:type="string">text</item>                    <item name="label" xsi:type="string" translate="true">Order number</item>                </item>            </argument>        </column>            <column name="first_name">            <argument name="data" xsi:type="array">                <item name="config" xsi:type="array">                    <item name="filter" xsi:type="string">text</item>                    <item name="label" xsi:type="string" translate="true">First Name</item>                </item>            </argument>        </column>           <column name="email">            <argument name="data" xsi:type="array">                <item name="config" xsi:type="array">                    <item name="filter" xsi:type="string">text</item>                    <item name="label" xsi:type="string" translate="true">Email</item>                </item>            </argument>        </column>             <column name="track_code">            <argument name="data" xsi:type="array">                <item name="config" xsi:type="array">                  <item name="editor" xsi:type="array">                     <item name="editorType" xsi:type="string">text</item>                     <item name="validation" xsi:type="array">                         <item name="required-entry" xsi:type="boolean">true</item>                     </item>                   </item>                                   <item name="filter" xsi:type="string">text</item>                   <item name="label" xsi:type="string" translate="true">Track Code</item>                </item>            </argument>        </column>         <column name="status">             <argument name="data" xsi:type="array">               <item name="sortOrder" xsi:type="number">50</item>                 <item name="options" xsi:type="object">Aayanshtech\Replacement\Ui\Component\Listing\Grid\Column\Status</item>                 <item name="config" xsi:type="array">                     <item name="filter" xsi:type="string">select</item>                     <item name="label" xsi:type="string" translate="true">Status</item>                     <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>                     <item name="dataType" xsi:type="string">select</item>                     <item name="editor" xsi:type="array">                     <item name="editorType" xsi:type="string">select</item>                         <item name="validation" xsi:type="array">                             <item name="required-entry" xsi:type="boolean">false</item>                         </item>                     </item>                 </item>             </argument>         </column>        <!-- Add Action with each row of grid and for this we will create a class Action -->        <actionsColumn name="actions" class="Aayanshtech\Replacement\Ui\Component\Listing\Grid\Column\Action">            <argument name="data" xsi:type="array">                <item name="config" xsi:type="array">                    <item name="resizeEnabled" xsi:type="boolean">false</item>                    <item name="resizeDefaultWidth" xsi:type="string">107</item>                    <item name="indexField" xsi:type="string">id</item>                </item>            </argument>        </actionsColumn>           </columns> </listing> 

Magento 2 collection filters for GRID are not working

I’m developing a module for Magento 2, but when trying to create a GRID, my filters are not working.

I have some settings in other class and load it to the collection, using it inside the _initSelect() function.

When I try to use the values from my other class the filters do not work, but if I set them manually in the _initSelect function, they work.

Here is an example:

enter image description here

If I to a echo $ this->getSelect()->assemble; the result is exactly the same both ways.

Anyone ever dealt with the problem before? If anyone is interested, here is the link to the module github: https://github.com/moloni/magento2/blob/devel/Model/ResourceModel/Orders/Collection.php