I’ve created a custom column in the report using UI components that use DataProvider in report_listing.xml
Unfortunately, this new custom column is not able to sort.
I made also a class for this column which extended Column class UiComponentListingColumntestColumn::applySorting() to change sorting but this method is only using existing columns from sales_order.
I’m only able to sort via existing in sales_order columns.
protected function applySorting()
{
$sorting = $this->getContext()->getRequestParam('sorting');
$isSortable = $this->getData('config/sortable');
if ($isSortable !== false
&& !empty($sorting['field'])
&& !empty($sorting['direction'])
&& $sorting['field'] === $this->getName()
) {
$this->getContext()->getDataProvider()->addOrder(
'custom_column',
strtoupper($sorting['direction'])
);
}
}
If there is no possibility to somehow made it like that, maybe I can kinda set values for a new column in another way to make possible sorting.