mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
#1087: the sort order on "group by" dashlets inside a dashboard is now saved as a user preference.
SVN:trunk[3744]
This commit is contained in:
@@ -446,6 +446,8 @@ class DisplayBlock
|
||||
$sFormat = isset($aExtraParams['format']) ? $aExtraParams['format'] : 'UI:Pagination:HeaderNoSelection';
|
||||
$sHtml .= $oPage->GetP(Dict::Format($sFormat, $iTotalCount));
|
||||
$sHtml .= $oPage->GetTable($aAttribs, $aData);
|
||||
|
||||
$oPage->add_ready_script("LoadGroupBySortOrder('$sId');\n$('#{$sId} table.listResults').unbind('sortEnd.group_by').bind('sortEnd.group_by', function() { SaveGroupBySortOrder('$sId', $(this)[0].config.sortList); })");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
29
js/utils.js
29
js/utils.js
@@ -143,6 +143,33 @@ function ReloadBlock(divId, sStyle, sSerializedFilter, sExtraParams)
|
||||
}
|
||||
}
|
||||
|
||||
function SaveGroupBySortOrder(sTableId, aValues)
|
||||
{
|
||||
var sDashboardId = $('#'+sTableId).closest('.dashboard_contents').attr('id');
|
||||
var sPrefKey = 'GroupBy_'+sDashboardId+'_'+sTableId;
|
||||
if (aValues.length != 0)
|
||||
{
|
||||
$sValue = JSON.stringify(aValues);
|
||||
if (GetUserPreference(sPrefKey, null) != $sValue)
|
||||
{
|
||||
SetUserPreference(sPrefKey, $sValue, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function LoadGroupBySortOrder(sTableId)
|
||||
{
|
||||
var sDashboardId = $('#'+sTableId).closest('.dashboard_contents').attr('id');
|
||||
var sPrefKey = 'GroupBy_'+sDashboardId+'_'+sTableId;
|
||||
var sValues = GetUserPreference(sPrefKey, null);
|
||||
if (sValues != null)
|
||||
{
|
||||
aValues = JSON.parse(sValues);
|
||||
window.setTimeout(function () { $('#'+sTableId+' table.listResults').trigger('sorton', [aValues]); }, 50);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the display and value of a file input widget when the user picks a new file
|
||||
*/
|
||||
@@ -372,7 +399,7 @@ function PropagateCheckBox(bCurrValue, aFieldsList, bCheck)
|
||||
|
||||
function FixTableSorter(table)
|
||||
{
|
||||
if ($('th.header', table).length == 0)
|
||||
if (table[0].config == undefined)
|
||||
{
|
||||
// Table is not sort-able, let's fix it
|
||||
var checkbox = (table.find('th:first :checkbox').length > 0);
|
||||
|
||||
Reference in New Issue
Block a user