mirror of
https://github.com/Combodo/iTop.git
synced 2026-07-12 09:46:36 +02:00
WIP Sort working on all types but client-side
This commit is contained in:
@@ -196,9 +196,12 @@ var iTopDataTableTreeGrouping = (function ($) {
|
||||
// Friendly name is always loaded; it sorts better than the numeric DB id
|
||||
return sMData.replace(/\/_key_$/, '/friendlyname');
|
||||
}
|
||||
// External key attributes store a numeric ID in /raw — use /friendlyname instead
|
||||
// External/hierarchical key attributes store a numeric ID in "/raw", use "/friendlyname" instead.
|
||||
// AttributeHierarchicalKey extends AttributeExternalKey but its PHP class name does not contain
|
||||
// "ExternalKey", hence the separate check.
|
||||
if (oCol.metadata && typeof oCol.metadata.attribute_type === 'string' &&
|
||||
oCol.metadata.attribute_type.indexOf('ExternalKey') !== -1) {
|
||||
(oCol.metadata.attribute_type.indexOf('ExternalKey') !== -1 ||
|
||||
oCol.metadata.attribute_type.indexOf('HierarchicalKey') !== -1)) {
|
||||
return sMData + '/friendlyname';
|
||||
}
|
||||
return sMData + '/raw';
|
||||
|
||||
@@ -115,10 +115,14 @@ class AjaxRenderController
|
||||
|
||||
foreach ($aColumnsLoad[$sAlias] as $sAttCode) {
|
||||
$aObj[$sAlias."/".$sAttCode] = $aObject[$sAlias]->GetAsHTML($sAttCode);
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
// Expose the friendly name of external/hierarchical keys so JS can sort by label
|
||||
if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) {
|
||||
$aObj[$sAlias."/".$sAttCode."/friendlyname"] = $aObject[$sAlias]->Get($sAttCode.'_friendlyname');
|
||||
}
|
||||
$bExcludeRawValue = false;
|
||||
// Only retrieve raw (stored) value for simple fields
|
||||
foreach (cmdbAbstractObject::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude) {
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
if (is_a($oAttDef, $sAttDefClassToExclude, true)) {
|
||||
$bExcludeRawValue = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user