14

To fulfil the requirement, we have gone through many approaches and found the best solution for pagination on Magento2 custom collection. Here we are going to explain the best approach please follow the steps. Note: Assuming that You have created a basic module in Magento2. Here Ipragmatech is our package and Ipreward is our module. Please, change your ...


4

I got the solution as below: use Magento\User\Model\ResourceModel\User\CollectionFactory as UserCollectionFactory; /** * @var \Arrow\Customerassignment\Model\userFactory */ protected $_userFactory; public function __construct(UserCollectionFactory $userFactory) { $this->_userFactory = $userFactory; } /** * @...


3

Add the following code in your mageplaza_helloworld_post_listing.xml file <columns> ... ... <actionsColumn class="Mageplaza\HelloWorld\Ui\Component\Listing\Column\Actions" name="actions"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="indexField" xsi:type="string"&...


2

You have to apply below function to your datasource grid collection. <?php protected function _initSelect() { parent::_initSelect(); $tableName = $this->getTable('yout_table_name'); $this->getSelect() ->where("main_table.id IN SELECT min(id) FROM $tableName GROUP BY DATE(created_date)") ; }


2

Finally, I got the image in my exported Excel file. Here is my exportExcel.php (Controller) code: <?php namespace Vendorname\Modulename\Controller\Adminhtml\Report; use Magento\Framework\App\Filesystem\DirectoryList; class exportExcel extends \Magento\Backend\App\Action { /** * @var \Magento\Backend\Model\Session */ protected $...


1

Call below code instead Remove: <?php $newsCollection = $this->getNewsCollection(); ?> Replace : <?php $newsCollection = $this->_getNewsCollection(); ?>


1

I think you need to override vendor/magento/module-backend/Block/Widget/Grid/Export.php this File and check getExcelFile function And also see this exmple for adding image in Excel File Adding Image to the Excel


1

Try to replace data source section to: <dataSource name="grid_record_grid_list_data_source"> <argument name="dataProvider" xsi:type="configurableObject"> <argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument> <argument name="name" xsi:...


1

You need to apply your custom class(Namespace\Modulename\Ui\Component\Listing\Columns\Date) instead of default magento class (Magento\Ui\Component\Listing\Columns\Date). Now create above given class file located at : Namespace\Modulename\Ui\Component\Listing\Columns\Date <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt ...


1

To remove Pager use this code at grid.php: public function __construct() { parent::__construct(); $this->setSaveParametersInSession(true); $this->setPagerVisibility(false); $this->setUseAjax(true); } For remove checkboxes, use below code at grid.php (same file): protected function _prepareMassaction() { return $this; } To ...


Only top voted, non community-wiki answers of a minimum length are eligible