即時嘗試在角度數據表中實現我的自定義加載。我查了文檔:https://l-lin.github.io/angular-datatables/#/overrideLoadingTpl,有建議的實現:在Angular Datatables中自定義加載
angular.module('showcase', ['datatables']).
factory('DTLoadingTemplate', dtLoadingTemplate);
function dtLoadingTemplate() {
return {
html: '<img src="images/loading.gif">'
};
}
所以,在我的自定義選項我注入裝載在選項sLoadingRecords和sProcessing,但犯規的作品。
.factory('myDTOptions', function (DTOptionsBuilder,DTLoadingTemplate) {
return {
option1: function(){
return DTOptionsBuilder.newOptions()
.withPaginationType('full_numbers')
.withDisplayLength(10)
.withBootstrap()
.withOption('responsive', true)
.withLanguage({
"sEmptyTable": "No hay información disponible",
"sInfo": "Mostrando _START_ a _END_ de _TOTAL_ entradas",
"sInfoEmpty": "Mostrando 0 a 0 de 0 entradas",
"sInfoFiltered": "(filtrada de _MAX_ entradas totales)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sLengthMenu": "Mostrando _MENU_ entradas",
"sLoadingRecords": DTLoadingTemplate,
"sProcessing": DTLoadingTemplate,,
"sSearch": "Buscar: ",
"sZeroRecords": "No se encuentra coincidencias en la búsqueda",
"oPaginate": {
//Dos opciones: https://github.com/DataTables/Plugins/issues/62
"sFirst": '<i class="fa fa-angle-double-left"></i>',
"sLast": '<i class="fa fa-angle-double-right"></i>',
"sNext": '<i class="fa fa-angle-right"></i>',
"sPrevious": '<i class="fa fa-angle-left"></i>'
},
"oAria": {
"sSortAscending": ": activar para ordenar columna ascendentemente",
"sSortDescending": ": activar para ordenar columna descendentemente"
}
})
/*
.withColVis()
.withColVisOption('aiExclude', [0,1,6,7,8])*/
}
任何想法如何刪除加載文本:BTW這個元素可以通過CSS類來稱呼? – Sana
@Sana如上所述'DTDefaultOptions.setLoadingTemplate('')'... – davidkonrad