How to Make Column Sorting “False” Using UI Component in Magento 2
Grids in Magento 2 are a way to list the items in a database table for better management. Grids are used to represent, filter and sort various data in the Magento backend using UI component.
They are also used to perform mass actions such as updates and deletes. The Grid enables you to sort single and multiple data-bound columns.
As the default Magento 2 admin grid disables sorting on Thumbnail, Salable Quantity and Actions, you can also make column sorting false using UI component in Magento 2 in your custom grid or columns.
For instance, the columns that contain buttons, URL link or code does not need sorting. In that scenario, use the below method and disable the sorting for custom columns.
Method to Make Column Sorting False Using UI Component in Magento 2
- Add tag <sortable> in your code
1 2 3 4 5 6 7 |
<column name="store_id" class="Magento\Store\Ui\Component\Listing\Column\Store"> <settings> <label translate="true">Purchase Point</label> <bodyTmpl>ui/grid/cells/html</bodyTmpl> <sortable>false</sortable> </settings> </column> |
If you find any doubt regarding this post, do mention them in the Comment section below.
I would be happy to help.
Feel free to share the solution with Magento Community via social media.
Thank You.
Jignesh Parmar
An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.
2 Comments
Not working for a custom column in the sales order grid.
Hello Vikas,
It’s working properly from our end.
Please re check your implemented code.
Thank You.