我试图在角度数据表中实现我的自定义加载。我检查了文档:https ://l-lin.github.io/angular-datatables/#/overrideLoadingTpl ,建议了一个实现:
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])*/
}