mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
Bug fix: properly show which column the table is sorted on, even for external keys.
Enhancement: sort the non-selected columns alphabetically SVN:trunk[2210]
This commit is contained in:
@@ -457,6 +457,11 @@ EOF;
|
|||||||
{
|
{
|
||||||
$aDefaultSort[] = "[".($iColOffset+$iPos).",".($bAscending ? '0' : '1')."]";
|
$aDefaultSort[] = "[".($iColOffset+$iPos).",".($bAscending ? '0' : '1')."]";
|
||||||
}
|
}
|
||||||
|
else if (($iPos = array_search(preg_replace('/_friendlyname$/', '', $sColCode), $aUniqueOrderedList)) !== false)
|
||||||
|
{
|
||||||
|
// if sorted on the friendly name of an external key, then consider it sorted on the column that shows the links
|
||||||
|
$aDefaultSort[] = "[".($iColOffset+$iPos).",".($bAscending ? '0' : '1')."]";
|
||||||
|
}
|
||||||
else if($sColCode == 'friendlyname' && $bViewLink)
|
else if($sColCode == 'friendlyname' && $bViewLink)
|
||||||
{
|
{
|
||||||
$aDefaultSort[] = "[".($iColOffset).",".($bAscending ? '0' : '1')."]";
|
$aDefaultSort[] = "[".($iColOffset).",".($bAscending ? '0' : '1')."]";
|
||||||
@@ -474,7 +479,6 @@ var oTable = $('#{$this->iListId} table.listResults');
|
|||||||
oTable.tablesorter( { $sHeaders widgets: ['myZebra', 'truncatedList'] $sSortList} ).tablesorterPager({container: $('#pager{$this->iListId}'), totalRows:$iCount, size: $iPageSize, filter: '$sOQL', extra_params: '$sExtraParams', select_mode: '$sSelectModeJS', displayKey: $sDisplayKey, columns: $sJSColumns, class_aliases: $sJSClassAliases $sCssCount});
|
oTable.tablesorter( { $sHeaders widgets: ['myZebra', 'truncatedList'] $sSortList} ).tablesorterPager({container: $('#pager{$this->iListId}'), totalRows:$iCount, size: $iPageSize, filter: '$sOQL', extra_params: '$sExtraParams', select_mode: '$sSelectModeJS', displayKey: $sDisplayKey, columns: $sJSColumns, class_aliases: $sJSClassAliases $sCssCount});
|
||||||
EOF
|
EOF
|
||||||
);
|
);
|
||||||
|
|
||||||
//if ($iNbPages == 1)
|
//if ($iNbPages == 1)
|
||||||
if (false)
|
if (false)
|
||||||
{
|
{
|
||||||
@@ -663,15 +667,21 @@ class DataTableSettings implements Serializable
|
|||||||
}
|
}
|
||||||
$aList = MetaModel::ListAttributeDefs($sClass);
|
$aList = MetaModel::ListAttributeDefs($sClass);
|
||||||
|
|
||||||
// Add the other (non visible ones)
|
// Add the other (non visible ones), sorted in alphabetical order
|
||||||
|
$aTempData = array();
|
||||||
foreach($aList as $sAttCode => $oAttDef)
|
foreach($aList as $sAttCode => $oAttDef)
|
||||||
{
|
{
|
||||||
if ( (!array_key_exists($sAttCode, $this->aColumns[$sAlias])) && (!$oAttDef instanceof AttributeLinkSet))
|
if ( (!array_key_exists($sAttCode, $this->aColumns[$sAlias])) && (!$oAttDef instanceof AttributeLinkSet))
|
||||||
{
|
{
|
||||||
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, false /* bChecked */, 'none');
|
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, false /* bChecked */, 'none');
|
||||||
if ($aFieldData) $this->aColumns[$sAlias][$sAttCode] = $aFieldData;
|
if ($aFieldData) $aTempData[$aFieldData['label']] = $aFieldData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ksort($aTempData);
|
||||||
|
foreach($aTempData as $sLabel => $aFieldData)
|
||||||
|
{
|
||||||
|
$this->aColumns[$sAlias][$aFieldData['code']] = $aFieldData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user