75
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 ...
36
votes
Accepted
Display an image in the admin grid in magento 2
Your ui component xml should have this added:
<column name="image" class="Your\Modulename\Ui\Component\Listing\Column\Thumbnail">
<argument name="data" xsi:type="array">
<...
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\...
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="...
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 ...
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="...
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">...
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 ...
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="...
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 ...
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.
...
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:...
19
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="...
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"&...
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\...
17
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="...
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 ...
16
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" ...
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">{...
14
votes
Accepted
To add default filter to grid in Magento2?
If you define grid collection thought layout than you can use updater to add default filter.
<argument name="dataSource" xsi:type="object">
Tutorial\SimpleNews\Model\Resource\News\...
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 ...
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">
&...
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:...
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/...
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 ...
13
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 ...
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:...
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&...
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="...
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()
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
grid × 1391magento2 × 605
admin × 320
magento-1.9 × 235
adminhtml × 233
uicomponent × 181
collection × 98
filter × 96
module × 67
magento-2.1 × 64
grid-serlization × 58
order-grid × 56
product × 51
magento-1.7 × 48
custom × 48
magento-1 × 46
customer × 41
magento-1.8 × 39
column × 38
adminform × 36
magento2.2 × 35
massaction × 35
backend × 34
magento2.3 × 31
database × 30