mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
List: Remove vertical scrolling for all lists except dashlets
This commit is contained in:
@@ -914,6 +914,7 @@ class DashletObjectList extends Dashlet
|
||||
'menu' => $sShowMenu,
|
||||
'table_id' => self::APPUSERPREFERENCES_PREFIX.$this->sId,
|
||||
'surround_with_panel' => false,
|
||||
'max_height' => '500px',
|
||||
);
|
||||
$sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occurring in the same DOM)
|
||||
$oBlock->DisplayIntoContentBlock($oPanel, $oPage, $sBlockId, array_merge($aExtraParams, $aParams));
|
||||
|
||||
@@ -169,6 +169,8 @@ class DisplayBlock
|
||||
/** bool add toolkit menu */
|
||||
'selectionMode',
|
||||
/**positive or negative*/
|
||||
'max_height',
|
||||
/** string Max. height of the list, if not specified will occupy all the available height no matter the pagination */
|
||||
], DataTableUIBlockFactory::GetAllowedParams()),
|
||||
'list_search' => array_merge([
|
||||
'update_history',
|
||||
|
||||
@@ -337,7 +337,7 @@ class UILinksWidgetDirect
|
||||
|
||||
$oPage->add(<<<HTML
|
||||
<form id="ObjectsAddForm_{$this->sInputid}">
|
||||
<div id="SearchResultsToAdd_{$this->sInputid}" style="vertical-align:top;background: #fff;height:100%;overflow:auto;padding:0;border:0;">
|
||||
<div id="SearchResultsToAdd_{$this->sInputid}">
|
||||
<div style="background: #fff; border:0; text-align:center; vertical-align:middle;"><p>{$sEmptyList}</p></div>
|
||||
</div>
|
||||
<input type="hidden" id="count_{$this->sInputid}" value="0"/>
|
||||
|
||||
@@ -4,4 +4,3 @@
|
||||
*/
|
||||
|
||||
@import "block-csv";
|
||||
@import "block-indirect-links";
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -386,6 +386,11 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
$aOptions['iPageSize'] = $oCustomSettings->iDefaultPageSize;
|
||||
}
|
||||
|
||||
// Max height is only set if necessary, otherwise we want the list to occupy all the height it can depending on its pagination
|
||||
if (isset($aExtraParams['max_height'])) {
|
||||
$aOptions['sMaxHeight'] = $aExtraParams['max_height'];
|
||||
}
|
||||
|
||||
$aOptions['processing'] = true;
|
||||
$aOptions['sTableId'] = $sTableId;
|
||||
$aOptions['bUseCustomSettings'] = $bUseCustomSettings;
|
||||
@@ -619,6 +624,11 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
|
||||
$aOptions['iPageSize'] = $oCustomSettings->iDefaultPageSize;
|
||||
}
|
||||
|
||||
// Max height is only set if necessary, otherwise we want the list to occupy all the height it can depending on its pagination
|
||||
if (isset($aExtraParams['max_height'])) {
|
||||
$aOptions['sMaxHeight'] = $aExtraParams['max_height'];
|
||||
}
|
||||
|
||||
$aOptions['sTableId'] = $sTableId;
|
||||
$aOptions['bUseCustomSettings'] = $bUseCustomSettings;
|
||||
$aOptions['bViewLink'] = $bViewLink;
|
||||
|
||||
@@ -17,27 +17,6 @@ $('#{{ sListId }}').data('target', 'ibo-datatables--outer');
|
||||
if ($('#{{ oUIBlock.GetId() }}') != 'undefined' && $.fn.dataTable.isDataTable('#{{ oUIBlock.GetId() }}')) {
|
||||
$('#{{ oUIBlock.GetId() }}').DataTable().destroy(false);
|
||||
}
|
||||
//define maxHeight for Datatable
|
||||
var maxHeight{{ sListIDForVarSuffix }} = 300;
|
||||
if ($('#{{ oUIBlock.GetId() }}').closest('.ui-dialog').length > 0) {
|
||||
//we are in dialogbox
|
||||
maxHeight{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').closest('.ui-dialog-content').height();
|
||||
} else {
|
||||
maxHeight{{ sListIDForVarSuffix }} = $(window).height()-$('#ibo-top-container').outerHeight()+$('#ibo-main-content').height()-$('#ibo-main-content').outerHeight();
|
||||
}
|
||||
|
||||
if ($('#{{ oUIBlock.GetId() }}').closest('[data-target=search_results]').parent().find('.ibo-search-form-panel').length > 0) {
|
||||
//we are in dialogbox
|
||||
maxHeight{{ sListIDForVarSuffix }} = maxHeight{{ sListIDForVarSuffix }}-$('#{{ oUIBlock.GetId() }}').closest('[data-target=search_results]').parent().find('.ibo-search-form-panel').outerHeight();
|
||||
}
|
||||
if ($('#{{ oUIBlock.GetId() }}').closest('.ibo-panel--header').length > 0) {
|
||||
maxHeight{{ sListIDForVarSuffix }} = maxHeight{{ sListIDForVarSuffix }}-$('#{{ oUIBlock.GetId() }}').closest('.ibo-panel--header').outerHeight();
|
||||
}
|
||||
if (maxHeight{{ sListIDForVarSuffix }} < 300) {
|
||||
maxHeight{{ sListIDForVarSuffix }} = 250;
|
||||
} else {
|
||||
maxHeight{{ sListIDForVarSuffix }} = maxHeight{{ sListIDForVarSuffix }} -50;
|
||||
}
|
||||
|
||||
var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
language: {
|
||||
@@ -60,9 +39,11 @@ var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
sortDescending: ": {{ 'UI:Datatables:Language:Sort:Descending'|dict_s }}"
|
||||
}
|
||||
},
|
||||
scrollY: maxHeight{{ sListIDForVarSuffix }},
|
||||
scrollX: true,
|
||||
scrollCollapse: true,
|
||||
{% if oUIBlock.GetOption('sMaxHeight') is not empty %}
|
||||
scrollY: "{{ oUIBlock.GetOption('sMaxHeight') }}",
|
||||
scrollCollapse: true,
|
||||
{% endif %}
|
||||
lengthMenu: [[ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, -1], [ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, "{{ 'UI:Datatables:Language:DisplayLength:All'|dict_s }}"]],
|
||||
dom: "<'ibo-datatable--toolbar'<'ibo-datatable--toolbar-left' pl><'ibo-datatable--toolbar-right' i>>t<'ibo-datatable--toolbar'<'ibo-datatable--toolbar-left' pl><'ibo-datatable--toolbar-right' i>>",
|
||||
{% if( oUIBlock.GetOptions("sort")[0] is defined ) %}
|
||||
@@ -302,7 +283,6 @@ var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
});
|
||||
|
||||
oTable{{ sListIfForVarSuffix }}.select();
|
||||
$('#{{ oUIBlock.GetId() }}').closest(".dataTables_scrollBody").css('max-height', maxHeight{{ sListIDForVarSuffix }}-100);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,10 @@ $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
}
|
||||
},
|
||||
scrollX: true,
|
||||
scrollCollapse: true,
|
||||
{% if oUIBlock.GetOption('sMaxHeight') is not empty %}
|
||||
scrollY: "{{ oUIBlock.GetOption('sMaxHeight') }}",
|
||||
scrollCollapse: true,
|
||||
{% endif %}
|
||||
order: [],
|
||||
autoWidth: false,
|
||||
rowId: "id",
|
||||
|
||||
Reference in New Issue
Block a user