mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
autonumeric
This commit is contained in:
@ -276,12 +276,16 @@
|
||||
{
|
||||
name: "paginas_min",
|
||||
attr: {
|
||||
type: "number"
|
||||
type: "text",
|
||||
name : "paginas_min",
|
||||
class :"autonumeric"
|
||||
}
|
||||
},{
|
||||
name: "paginas_max",
|
||||
attr: {
|
||||
type: "number"
|
||||
type: "text",
|
||||
name : "paginas_max",
|
||||
class :"autonumeric"
|
||||
}
|
||||
},{
|
||||
name: "margen",
|
||||
@ -302,6 +306,20 @@
|
||||
} );
|
||||
|
||||
|
||||
editor3.on('open',(event)=>{
|
||||
$("input.autonumeric").each(function () {
|
||||
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
if(autoNumericInstance){
|
||||
autoNumericInstance.remove()
|
||||
|
||||
}
|
||||
new AutoNumeric(this, {
|
||||
decimalCharacter: ",",
|
||||
digitGroupSeparator: ".",
|
||||
unformatOnSubmit : true,
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
// Definición de la tabla
|
||||
theTable3 = $('#tableOfPapelimpresionmargenes').DataTable({
|
||||
@ -332,13 +350,14 @@
|
||||
async: true,
|
||||
}),
|
||||
columns : [
|
||||
{ 'data': 'paginas_min' },
|
||||
{ 'data': 'paginas_max' },
|
||||
{ 'data': 'paginas_min' , render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'paginas_max' , render : (d) => `<span class="autonumeric">${d}</span>`},
|
||||
{ 'data': 'margen' },
|
||||
{ data: actionBtns3,
|
||||
className: 'row-edit dt-center'}
|
||||
],
|
||||
columnDefs: [
|
||||
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
@ -356,7 +375,13 @@
|
||||
} ]
|
||||
});
|
||||
|
||||
|
||||
theTable3.on('draw',() => {
|
||||
AutoNumeric.multiple("span.autonumeric", {
|
||||
digitGroupSeparator: ".",
|
||||
decimalCharacter: ",",
|
||||
unformatOnSubmit: true
|
||||
});
|
||||
})
|
||||
// Activate an inline edit on click of a table cell
|
||||
$(document).on('click', '.btn-edit3', function(e) {
|
||||
editor3.inline(
|
||||
@ -371,9 +396,22 @@
|
||||
);
|
||||
} );
|
||||
|
||||
|
||||
|
||||
// Obtención del id para editar
|
||||
editor3.on( 'preSubmit', function ( e, d, type ) {
|
||||
if (d.data) {
|
||||
Object.keys(d.data).forEach(function (key) {
|
||||
// Find all elements with class .autonumeric
|
||||
$("input.autonumeric").each(function () {
|
||||
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
if (autoNumericInstance) {
|
||||
// Get raw value and update the corresponding field
|
||||
let rawValue = autoNumericInstance.getNumericString();
|
||||
d.data[key][this.name] = rawValue; // Ensure the correct name attribute is used
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if ( type === 'create'){
|
||||
d.data[0]['papel_impresion_id'] = id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user