mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
autonumeric
This commit is contained in:
@ -115,11 +115,21 @@
|
||||
table : "#tableOfTarifamanipuladolineas",
|
||||
idSrc: 'id',
|
||||
fields: [ {
|
||||
name: "tirada_min"
|
||||
name: "tirada_min",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tirada_min",
|
||||
class :"autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "precio_max"
|
||||
}, {
|
||||
name: "tirada_max"
|
||||
name: "tirada_max",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tirada_max",
|
||||
class :"autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "precio_min"
|
||||
}, {
|
||||
@ -137,7 +147,36 @@
|
||||
]
|
||||
} );
|
||||
|
||||
editor.on('open',(event)=>{
|
||||
$("input.autonumeric").each(function () {
|
||||
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
if(autoNumericInstance){
|
||||
autoNumericInstance.remove()
|
||||
|
||||
}
|
||||
new AutoNumeric(this, {
|
||||
decimalCharacter: ",",
|
||||
decimalPlaces : 0,
|
||||
digitGroupSeparator: ".",
|
||||
unformatOnSubmit : true,
|
||||
});
|
||||
})
|
||||
})
|
||||
editor.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]['tarifa_manipulado_id'] = id;
|
||||
}
|
||||
@ -184,9 +223,9 @@
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'tirada_min' },
|
||||
{ 'data': 'precio_max' },
|
||||
{ 'data': 'tirada_max' },
|
||||
{ 'data': 'tirada_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_max', },
|
||||
{ 'data': 'tirada_max',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_min' },
|
||||
{ 'data': 'margen' },
|
||||
{
|
||||
@ -245,7 +284,14 @@
|
||||
);
|
||||
} );
|
||||
|
||||
|
||||
theTable.on('draw',() => {
|
||||
AutoNumeric.multiple("span.autonumeric", {
|
||||
digitGroupSeparator: ".",
|
||||
decimalCharacter: ",",
|
||||
decimalPlaces : 0,
|
||||
unformatOnSubmit: true
|
||||
});
|
||||
})
|
||||
// Delete row
|
||||
$('#tableOfTarifamanipuladolineas').on( 'click', 'tbody span.remove', function (e) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user