handsontable-helpers
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -26,7 +26,7 @@ /** | ||
if(typeof params == "string") params = { | ||
if (typeof params == "string") params = { | ||
parent: document.querySelector(params) | ||
}; | ||
if(typeof hot != "undefined") hot.destroy(); | ||
if (typeof hot != "undefined") hot.destroy(); | ||
@@ -36,8 +36,8 @@ params = params || {}; | ||
params.parent = params.parent || document.querySelector("#ht") || document.body; | ||
if(typeof params.contextMenu === "undefined") params.contextMenu = true; | ||
if (typeof params.contextMenu === "undefined") params.contextMenu = true; | ||
else params.contextMenu = params.contextMenu; | ||
var columns = HH.getColumns(objArr, params.cols); | ||
if(params.readOnly) columns = columns.map(function (a) { | ||
if (params.readOnly) columns = columns.map(function(a) { | ||
a.readOnly = true; | ||
@@ -48,13 +48,13 @@ return a; | ||
hot = new Handsontable(params.parent, { | ||
data: HH.stringifyArrObj(objArr), | ||
columns: columns, | ||
colHeaders: columns.map(function (a) { | ||
return a.data; | ||
}), | ||
manualColumnResize: true, | ||
columnSorting: true, | ||
contextMenu: params.contextMenu, | ||
afterChange: params.afterChange, | ||
afterRemoveRow: params.afterRemoveRow, | ||
colWidths: params.colWidths | ||
data: HH.stringifyArrObj(objArr), | ||
columns: columns, | ||
colHeaders: columns.map(function(a) { | ||
return a.data; | ||
}), | ||
manualColumnResize: true, | ||
columnSorting: true, | ||
contextMenu: params.contextMenu, | ||
afterChange: params.afterChange, | ||
afterRemoveRow: params.afterRemoveRow, | ||
colWidths: params.colWidths | ||
}); | ||
@@ -88,4 +88,4 @@ }; | ||
var jsType = typeof val; | ||
if(jsType == "string") { | ||
if(HH.reJsStrData.test(val)) jsType = "date"; | ||
if (jsType == "string") { | ||
if (HH.reJsStrData.test(val)) jsType = "date"; | ||
} | ||
@@ -96,6 +96,6 @@ if (!props[key]) props[key] = jsType; | ||
if(cols) { | ||
if (cols) { | ||
for (var j = 0; j < cols.length; j++) { | ||
var colName = cols[j]; | ||
if(props[colName]) { | ||
if (props[colName]) { | ||
col = HH.setColType(colName, props[colName]); | ||
@@ -175,5 +175,7 @@ columns.push(col); | ||
HH.workChanges = function(changes, arr, columns) { | ||
if (!changes) return; | ||
HH.afterChange = function(changes, src) { | ||
if (src == "loadData") return; | ||
if (!changes || !changes.length) return; | ||
var changesArr = []; | ||
@@ -288,5 +290,5 @@ | ||
var isDate = HH.reJsStrData.test(cell); | ||
if (type == "object") arr[i][key] = JSON.stringify(cell); | ||
else if(isDate) arr[i][key] = moment(new Date(cell)).format('DD-MMM-YYYY'); | ||
else if (isDate) arr[i][key] = moment(new Date(cell)).format('DD-MMM-YYYY'); | ||
} | ||
@@ -293,0 +295,0 @@ } |
{ | ||
"name": "handsontable-helpers", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "handsontable.helpers.js", |
10972
239