mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
add format number in datatables
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
export function getToken()
|
||||
{
|
||||
export function getToken() {
|
||||
const scriptUrl = new URL(import.meta.url);
|
||||
const params = new URLSearchParams(scriptUrl.search);
|
||||
|
||||
@ -10,3 +9,67 @@ export function getToken()
|
||||
export function capitalizeFirstLetter(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
|
||||
export const initAutonumeric = () => {
|
||||
$(document).on('draw.dt', (event) => {
|
||||
$("span.autonumeric").each(function () {
|
||||
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
if (!autoNumericInstance) {
|
||||
new AutoNumeric(this, {
|
||||
digitGroupSeparator: ".",
|
||||
decimalCharacter: ",",
|
||||
allowDecimalPadding : 'floats',
|
||||
decimalPlaces: 2,
|
||||
unformatOnSubmit: true,
|
||||
|
||||
});
|
||||
}
|
||||
})
|
||||
// $(':input[type="number"]').each(function(){
|
||||
// $(this).attr('type','text')
|
||||
// let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
// if (!autoNumericInstance) {
|
||||
// new AutoNumeric(this, {
|
||||
// digitGroupSeparator: ".",
|
||||
// decimalCharacter: ",",
|
||||
// allowDecimalPadding : 'floats',
|
||||
// decimalPlaces: 2,
|
||||
// unformatOnSubmit: true,
|
||||
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
})
|
||||
// editor.on('open', (event) => {
|
||||
// $("input.autonumeric").each(function () {
|
||||
// let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
// if (autoNumericInstance) {
|
||||
// autoNumericInstance.remove()
|
||||
|
||||
// }
|
||||
// new AutoNumeric(this, {
|
||||
// decimalCharacter: ",",
|
||||
// digitGroupSeparator: ".",
|
||||
// allowDecimalPadding : 'floats',
|
||||
// decimalPlaces: 2,
|
||||
// unformatOnSubmit: true,
|
||||
// });
|
||||
// })
|
||||
// })
|
||||
// editor.on('preSubmit', (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
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
}
|
||||
4
httpdocs/assets/js/safekat/pages/layout.js
Normal file
4
httpdocs/assets/js/safekat/pages/layout.js
Normal file
@ -0,0 +1,4 @@
|
||||
import { initAutonumeric } from "../common/common.js";
|
||||
|
||||
|
||||
initAutonumeric()
|
||||
@ -91,10 +91,10 @@ class MaquinasList {
|
||||
{ 'data': 'id' },
|
||||
{ 'data': 'nombre' },
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'ancho_impresion' },
|
||||
{ 'data': 'alto_impresion' },
|
||||
{ 'data': 'min' },
|
||||
{ 'data': 'max' }
|
||||
{ 'data': 'ancho_impresion',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'alto_impresion',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'max',render : (d) => `<span class="autonumeric">${d}</span>` }
|
||||
];
|
||||
|
||||
const actions = ['edit', 'delete'];
|
||||
|
||||
Reference in New Issue
Block a user