Commit 76bac4fb by Billy Larru

getSourceData en HandsonTable

parent 539a8d33
let listaSedes = []; let listaSedes = [];
let handsonTable; let handsonTable;
// This example creates a date editor that will show MM/YYYY
const TA_EDITOR_HORA = Handsontable.editors.TextEditor.prototype.extend();
TA_EDITOR_HORA.prototype.createElements = function () {
Handsontable.editors.TextEditor.prototype.createElements.apply(this, arguments);
// You need to require/import the "inputmask" library
var im = new Inputmask('99:99');
// Create password input and update relevant properties
this.TEXTAREA = document.createElement('input');
this.TEXTAREA.setAttribute('type', 'text');
this.TEXTAREA.className = 'text';
im.mask(this.TEXTAREA);
this.textareaStyle = this.TEXTAREA.style;
this.textareaStyle.width = 0;
this.textareaStyle.height = 0;
// Replace textarea with password input
Handsontable.dom.empty(this.TEXTAREA_PARENT);
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
};
function listarSedes(selectorName) { function listarSedes(selectorName) {
ajaxWebService.get(URI_SEDES).then((result) => { ajaxWebService.get(URI_SEDES).then((result) => {
...@@ -59,6 +82,8 @@ function mostrarVistaPrevia() { ...@@ -59,6 +82,8 @@ function mostrarVistaPrevia() {
}) })
.forEach(dr => { .forEach(dr => {
let obj = { let obj = {
rol_id: rol.id,
detallerol_id: dr.id,
policia_dni: rol.policia_dni, policia_dni: rol.policia_dni,
policia_nombres: rol.policia_nombres, policia_nombres: rol.policia_nombres,
fecha_entrada: dr.fecha_entrada, fecha_entrada: dr.fecha_entrada,
...@@ -144,7 +169,10 @@ function mostrarVistaPrevia() { ...@@ -144,7 +169,10 @@ function mostrarVistaPrevia() {
dateFormat: 'DD/MM/YYYY', dateFormat: 'DD/MM/YYYY',
readOnly: true readOnly: true
} }
] ],
// afterChange: (change, source) => {
// console.log(`change= ${change}, source=${source}`);
// }
}); });
registrarEventoTab(); registrarEventoTab();
} }
...@@ -167,7 +195,7 @@ function registrarEventoTab() { ...@@ -167,7 +195,7 @@ function registrarEventoTab() {
var rowIndex = selection[0]; var rowIndex = selection[0];
var colIndex = selection[1]; var colIndex = selection[1];
console.log(`row=${rowIndex}, col=${colIndex}`) // console.log(`row=${rowIndex}, col=${colIndex}`)
//rowIndex++; //rowIndex++;
colIndex++; colIndex++;
...@@ -185,34 +213,10 @@ function registrarEventoTab() { ...@@ -185,34 +213,10 @@ function registrarEventoTab() {
}); });
} }
function guardarCambios() {
let data = handsonTable.getSourceData();
}
// This example creates a date editor that will show MM/YYYY
const TA_EDITOR_HORA = Handsontable.editors.TextEditor.prototype.extend();
TA_EDITOR_HORA.prototype.createElements = function () {
Handsontable.editors.TextEditor.prototype.createElements.apply(this, arguments);
// You need to require/import the "inputmask" library
var im = new Inputmask('99:99');
// Create password input and update relevant properties
this.TEXTAREA = document.createElement('input');
this.TEXTAREA.setAttribute('type', 'text');
this.TEXTAREA.className = 'text';
im.mask(this.TEXTAREA);
this.textareaStyle = this.TEXTAREA.style;
this.textareaStyle.width = 0;
this.textareaStyle.height = 0;
// Replace textarea with password input
Handsontable.dom.empty(this.TEXTAREA_PARENT);
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
};
...@@ -246,4 +250,5 @@ $().ready(function () { ...@@ -246,4 +250,5 @@ $().ready(function () {
// defaultConfigDataTable(); // defaultConfigDataTable();
defaultConfigHandsonTable(); defaultConfigHandsonTable();
$("#btnVistaPrevia").click(mostrarVistaPrevia); $("#btnVistaPrevia").click(mostrarVistaPrevia);
$("#btnGuardarCambios").click(guardarCambios);
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment