I have created a custom column named printed which shows the invoice is printed or not and works well.
But how to apply sorting in in it like when i click on printed firstly it shows all data with pagination of printed yes then if i again click on it it sort by No.
So basically i want to know how to sort that data out by asc or desc order according to my printed value?
Any help is appreciated.
1 Answer 1
by default you should be able to click on the column to sort value ASC/DESC, unless you have added a <sortable>false</sortable> node inside the setting node like this:
<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 have sortable node in there, delete it or set it to true.
If you mean to add a default sort when you go to the grid, without having to click on anything, then you have to add a sorting node.
More info here: https://devdocs.magento.com/guides/v2.4/ui_comp_guide/components/ui-column.html
Explore related questions
See similar questions with these tags.