Skip to main content
76 votes
Accepted

Magento 2 custom grid column sort order

Try this solution Use below line to sort the column in grid. <item name="sortOrder" xsi:type="number">6</item> Open you database table ui_bookmark. Search the name of your uiComponent ...
Makwana Ketan's user avatar
35 votes
Accepted

Magento 2 massaction delete not working

Try the following code: <?php namespace Vendor\ModuleName\Controller\Adminhtml\Module; use Magento\Backend\App\Action\Context; use Magento\Ui\Component\MassAction\Filter; use Vendor\ModuleName\...
Bartłomiej Szubert's user avatar
30 votes
Accepted

Magento2.1 ui grid, remove or clear filter issue (after removing filter, result row apply to whole collection)

Just to add to the previous solution by Tony Bartiloro. The specific fix is to add the 'storageConfig' item. If this is missing you will see the issue where row data is duplicated. <item name="...
Chris's user avatar
  • 1,004
28 votes
Accepted

"Unknown columns" error when executing a mass action

It creates an issue because you didn't define $_idFieldName in your ResourceModel Collection Please add this line in Vendor\MyModule\Model\ResourceModel\MyModel\Collectionfile. /** * @var ...
Keyur Shah's user avatar
  • 18.1k
28 votes
Accepted

How to display Yes/No values in admin grid (Magento2)?

Method 1: If you have boolean value 0 and 1 use default option class Magento\Config\Model\Config\Source\Yesno app/code/Vendor/Theme/view/adminhtml/ui_component/your_ui_grid.xml <column name="...
Prince Patel's user avatar
  • 22.8k
26 votes
Accepted

Magento Grid Component not Sorting Correctly

Alright, I can't pretend to understand why yet, but the problem was the data argument of my dataProvider argument. <!-- ... --> <argument name="dataProvider" xsi:type="configurableObject">...
Alana Storm's user avatar
  • 44.4k
23 votes
Accepted

Magento 2: what are the benefits of using UI grid components over the standard Grid.php?

I will list the ones I found so far. extensibility. You can add a new xml in order to add new columns. configuration over code. Less code for logic, more declarative xmls. less traffic over the ...
Marius's user avatar
  • 198k
23 votes

magento 2 html in ui component grid column

<column name="order" class="Vendor\OrderExport\Ui\Component\Listing\Column\VendorLog\OrderId"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="...
pankijs's user avatar
  • 556
22 votes

Magento 2: what are the benefits of using UI grid components over the standard Grid.php?

@raphael-at-digital-pianism asked me to post this list of things I think are wrong with the adminhtml grid UI component XML, so here goes: What is wrong with adminhtml grid UI component XML? Slow ...
Vinai's user avatar
  • 14k
20 votes
Accepted

UI Component or Layout?

Each approach has upsides and downsides. I suggest using the ui-components one because this is where Magento 2 is going right now. The layouts and blocks approach is just legacy from the M1 version. ...
Marius's user avatar
  • 198k
20 votes
Accepted

In Magento 2, add link to admin grid values

I have just make Link and redirect it product detail page. Please check my answer and change as per your need. Create a actionsColumn in ui component xml like below : <actionsColumn name="...
Dharmendra Jadav's user avatar
19 votes
Accepted

How to create custom Module Development in magento 2 from Scratch?

Namespace: Mastering\Itdesire 1.How to Create Module Mastering/Itdesire/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Pramod Kharade's user avatar
18 votes

Magento2.1 ui grid, remove or clear filter issue (after removing filter, result row apply to whole collection)

i had same issue and I resolve with this code in ui_component xml: <dataSource name="storelocator_store_listing_data_source"> <argument name="dataProvider" xsi:type="configurableObject"&...
Tony Bartiloro's user avatar
18 votes

Disable customer attribute in magento admin form

You need to create Namespace/Module/view/base/ui_component/customer_form.xml and add the following code <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="...
Shankar's user avatar
  • 442
17 votes
Accepted

Magento 2: What's the Difference Between the Two Grid Component Data Providers?

To me, that main difference is that the Magento/Framework/View/Element/UiComponent/DataProvider/DataProvider uses the Search API. The following classes are used in this class : Magento\Framework\Api\...
Raphael at Digital Pianism's user avatar
17 votes
Accepted

How to get dropdown in action column in magento admin grid

Here i give your answer please follow bellow steps your_grid.xml <actionsColumn name="actions" class="[vendor]\[module]\Ui\Component\Listing\Column\Actions"> <argument name="data" ...
Deexit Sanghani's user avatar
16 votes
Accepted

Reserved keyword in controller action - Magento 2

There are some words that you cannot use for class names. Basically the reserved php words like new, public, static, ... To overcome this and still allow these words in the urls Magento adds the ...
Marius's user avatar
  • 198k
16 votes
Accepted

How to add drop down in admin grid in magento 2

Add select options and component in column. Full column like this: <column name="items"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">{...
Prince Patel's user avatar
  • 22.8k
14 votes

Magento 2 - custom admin grid field - error when sorting or filtering

There is a factory method that you can use, and this is the addFilterToMap(). Where Magento 2 rendering filter just replace the subjects of the conditions based on the mapped fields you can call it ...
Mammouth's user avatar
  • 731
14 votes

Default filtering in UI Component Grid

You can create your own collection which will provide the items you like. Create a new collection. Sample\Sample\Model\ResourceModel\Posts\Grid\Collection that collection should: a. Implement the ...
Sakis's user avatar
  • 421
14 votes
Accepted

Filters move to bottom in admin grid

You need to define dependency in your module.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> &...
Priyank's user avatar
  • 7,702
14 votes
Accepted

Magento 2: How to add color picker in ui form

I recently needed to add a color picker to a category form. Here is what wound up working: Vendor/Module/view/adminhtml/ui_component/category_form.xml <?xml version="1.0"?> <form xmlns:...
Pmclain's user avatar
  • 2,618
13 votes

How to use renderer in column ui component grid in magento 2

You can renderer grid column as follow For Example to simple add "Test" with column values. 1) Define you renderer class to column Vendor\Modulename\Ui\Component\Listing\Column\Yourcolumn Vendor/...
Prince Patel's user avatar
  • 22.8k
13 votes
Accepted

move selectionsColumn in magento 2 to the left of admin grid

Step-1 :- Please comment all columns except of selectionsColumn(in uicomponent) & reload your admingrid first. So You'll get only checkbox column. Step-2 :- Now uncomment all columns & reload ...
Priyank M.'s user avatar
12 votes
Accepted

Magento2 : Remove decimal from quantity

This decimal comes from database. So if you need to remove this, then you need to create column renderer. Here is an example In your etc/module.xml file add sequence tag follows: <config xmlns:...
Sohel Rana's user avatar
  • 35.9k
12 votes

Magento2.1 ui grid, remove or clear filter issue (after removing filter, result row apply to whole collection)

I've got the same issue on Magento 2.3 and resolved by using the following code in ui_component.xml. <dataSource component="Magento_Ui/js/grid/provider" name="listing_data_source&...
Aasim Goriya's user avatar
  • 5,454
12 votes
Accepted

Magento 2 : How can I load an admin grid with pre-defined filter values?

Here is what I found out so far. This is not complete but it can take you on the right path. I conducted my tests by modifying the cms page listing ui component. I added this <item name="...
Marius's user avatar
  • 198k
12 votes

how to create grid using ui component with multi table(JOIN) in magento2?

You can display values from join two tables by using below model resource collection class function Add below function to your model resource collection function protected function _initSelect() ...
Suresh Chikani's user avatar
12 votes
Accepted

Magento 2:SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in where clause is ambiguous

protected function _initSelect() { $this->addFilterToMap('entity_id', 'main_table.entity_id'); parent::_initSelect(); $this->getSelect()->joinLeft( ['secondTable' => $this->...
MGento's user avatar
  • 1,519
11 votes
Accepted

In Magento 2 How can I display ui_component base grid column based on if else condition

In your app/code/Test/Testimonial/view/adminhtml/ui_component/testimonial_blog_listing.xml add in the column tag the class attribute: <column name="nameofyourcolumn" class="YourVendor\YourModule\...
ProcessKiller's user avatar

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