mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
Fix tooltips in datatables and add events to datatables init and draw actions
This commit is contained in:
@@ -450,9 +450,17 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer
|
||||
$oAttachmentTableBlock = DataTableUIBlockFactory::MakeForStaticData('', $aAttribs, $aData);
|
||||
$oAttachmentTableBlock->AddCSSClass('ibo-attachment--datatable');
|
||||
$this->oPage->AddUiBlock($oAttachmentTableBlock);
|
||||
foreach ($aData as $aRow) {
|
||||
$this->oPage->add_ready_script($aRow['js']);
|
||||
}
|
||||
|
||||
$sTableId = $oAttachmentTableBlock->GetId();
|
||||
$this->oPage->add_script(
|
||||
<<<JS
|
||||
$('#$sTableId').on('inited drawn', function(){
|
||||
$('#$sTableId [data-tooltip-content]').each(function(){
|
||||
CombodoGlobalToolbox.InitTooltipFromMarkup($(this), true);
|
||||
});
|
||||
});
|
||||
JS
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -541,7 +549,6 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer
|
||||
'upload-date' => $sAttachmentDateFormatted,
|
||||
'uploader' => $sAttachmentUploader,
|
||||
'type' => $sFileType,
|
||||
'js' => 'CombodoGlobalToolbox.InitTooltipFromMarkup($("#$sTrId [data-tooltip-content]"));',
|
||||
);
|
||||
|
||||
if ($bWithDeleteButton)
|
||||
|
||||
@@ -108,6 +108,7 @@ var oTable{{ sListId }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
{
|
||||
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
|
||||
}
|
||||
$('#{{ oUIBlock.GetId() }}').trigger('drawn');
|
||||
},
|
||||
{% endif %}
|
||||
rowId: "id",
|
||||
@@ -183,6 +184,7 @@ var oTable{{ sListId }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
this.parent().find('.dataTables_paginate').hide();
|
||||
this.parent().find('.dataTables_length').hide();
|
||||
}
|
||||
$('#{{ oUIBlock.GetId() }}').trigger('inited');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -46,5 +46,11 @@ $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||
sortable: true
|
||||
},
|
||||
{% endfor %}
|
||||
]
|
||||
],
|
||||
initComplete: function () {
|
||||
$('#{{ oUIBlock.GetId() }}').trigger('inited');
|
||||
},
|
||||
drawCallback: function(){
|
||||
$('#{{ oUIBlock.GetId() }}').trigger('drawn');
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user