Encontrado como hacerlo

This commit is contained in:
imnavajas
2023-09-05 15:28:53 +02:00
parent 5b4126f460
commit 1cce675f79

View File

@ -72,7 +72,7 @@
<div id="accordionTip2" class="accordion-collapse collapse show" data-bs-parent="#accordionPrecios"> <div id="accordionTip2" class="accordion-collapse collapse show" data-bs-parent="#accordionPrecios">
<div class="accordion-body"> <div class="accordion-body">
<div id="newButton" class="mb-4 float-end"></div>
<table id="tableOfPrecios" class="table table-striped table-hover" style="width: 100%;"> <table id="tableOfPrecios" class="table table-striped table-hover" style="width: 100%;">
<thead> <thead>
<tr> <tr>
@ -423,11 +423,11 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
order: [ 0, "asc" ], order: [ 0, "asc" ],
pageLength: 25, pageLength: 25,
lengthChange: true, lengthChange: true,
searching: false, searching: true,
paging: true, paging: true,
info: false, info: false,
//dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>', dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
"dom": 'lfBrtip', //dom: 'lBfrtip',
ajax : $.fn.dataTable.pipeline( { ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfTarifasEnvioPrecios') ?>', url: '<?= route_to('dataTableOfTarifasEnvioPrecios') ?>',
data: function ( d ) { data: function ( d ) {
@ -471,20 +471,19 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
], ],
language: { language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json" url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json",
}, },
/*buttons: [ buttons: [ 'copy', 'csv', 'excel', 'print', {
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5', extend: 'pdfHtml5',
orientation: 'landscape', orientation: 'landscape',
pageSize: 'A4' pageSize: 'A4'
}, }],
],*/
} );
new $.fn.dataTable.Buttons( theTable2, { initComplete: function () {
name: 'new', new $.fn.dataTable.Buttons(theTable2, {
name: 'test2',
buttons: [{
className: 'btn btn-primary float-end me-sm-3 me-1', className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline", extend: "createInline",
editor: editor2, editor: editor2,
@ -492,16 +491,18 @@ const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1;
submitTrigger: -1, submitTrigger: -1,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>' submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}, }
}]
});
theTable2.buttons('test2', null)
.container()
.insertBefore('.dataTables_length');
}
} ); } );
theTable2.buttons( 'new', null ).container().appendTo(
//theTable2.table().container()
'#panel'
);