Closed NiklasBr closed 10 months ago
Did you save the objects first? Sorting is still based on the query table.
All objects are saved, yes.
I tried to reproduce it. I used calcaulated value field with text and numbers only. In both cases sort works.
Still cannot get it to work with this class in Pimcore 6 which should return the content of IfsName
if displayName
is empty. Both fields are regular input fields with "regular" human-readable product names like "Green sock size L".
class DisplayNameCalculator
{
public static function compute($object, $context): ?string
{
if ($context->getFieldname() === 'displayNameCalculated') {
/** @var \Pimcore\Model\DataObject\Product $object */
$displayName = $object->getDisplayName();
return $displayName ?? $object->getIfsName();
}
Logger::error("Tried to calculate unkown field displayNameCalculated for object id: {$object->getId()} of class {$object->getClassName()}");
return null;
}
}
Have cleared caches and re-saved objects countless times by now, sorting does not work.
I cant still reproduce problem.
I have 2 object with field name
and names:
Green Sock size L and Green Sock size S
After save I can sort with my calculated field.
My compute method:
public static function compute($object, $context): ?string
{
/** @var \Pimcore\Model\DataObject\Test $object */
return $object->getName();
}```
Note how the last two are identical (and by all appearances randomly sorted the same way) even though I switched the ASC/DESC sort order. All other columns work fine for sorting both ascending and descending.
@NiklasBr Basically, I've set everything up as you did, using the latest version of dev-master. Everything seems to work correctly. Maybe the problem is with UTF signs in the name?
class NameCalculator
{
public static function compute($object, $context) {
if ($context->getFieldname() === "realname") {
$displayName = $object->getOthername();
return $displayName ?? $object->getName();
}
Logger::error("Tried to calculate unkown field realname for object id: {$object->getId()} of class {$object->getClassName()}");
return null;
}
}
Nope:
Thanks a lot for reporting the issue. The issue was not considered by us as "Priority" or "Backlog", so we're not gonna work on that anytime soon. In case this is a bug report, please create a pull request fixing the issue, we'll then review it as soon as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request, we'll then decide whether we'd accept it or not. Thanks for your understanding.
This is still relevant
Thanks a lot for reporting the issue. We did not consider the issue as "Priority" or "Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.
Just want to say that this still happens on 10.3
Thanks a lot for reporting the issue. We did not consider the issue as "Priority" or "Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.
Yup, still happening on 10.3.5
Dear community, it's been a while since that issue was updated the last time, so we decided to close it for now. If you're still interested in contributing, feel free to add comments here or contact us before creating a pull request to discuss next steps.
Thanks for your understanding.
Bug Report
Expected behavior
To be able to sort by calculated fields
Actual behavior
The grid view does not sort at all
Steps to reproduce