Encontrado como hacerlo

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

View File

@ -18,10 +18,10 @@
</div><!-- /.card-body --> </div><!-- /.card-body -->
<div class="pt-4"> <div class="pt-4">
<input type="submit" <input type="submit"
class="btn btn-primary float-start me-sm-3 me-1" class="btn btn-primary float-start me-sm-3 me-1"
name="save" name="save"
value="<?= lang("Basic.global.Save") ?>" value="<?= lang("Basic.global.Save") ?>"
/> />
<?= anchor(route_to("tarifaEnvioList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?> <?= anchor(route_to("tarifaEnvioList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
</div><!-- /.card-footer --> </div><!-- /.card-footer -->
@ -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,40 +471,41 @@ 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, {
className: 'btn btn-primary float-end me-sm-3 me-1', name: 'test2',
extend: "createInline", buttons: [{
editor: editor2, className: 'btn btn-primary float-end me-sm-3 me-1',
formOptions: { extend: "createInline",
submitTrigger: -1, editor: editor2,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>' formOptions: {
submitTrigger: -1,
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'
);
// Activate an inline edit on click of a table cell // Activate an inline edit on click of a table cell
$('#tableOfPrecios').on( 'click', 'tbody span.edit', function (e) { $('#tableOfPrecios').on( 'click', 'tbody span.edit', function (e) {
editor2.inline( editor2.inline(