Skip to content

Commit 8a80b65

Browse files
author
Dave Conway-Jones
committed
better handle old align in existing config
1 parent f5867e2 commit 8a80b65

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

node-red-node-ui-table/node.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,15 @@ module.exports = function (RED) {
6969
if (typeof (value) === "string") {
7070
return value.replace(/'/g, "'");
7171
}
72+
// fixup any old deprecated align -> hozAlign
73+
else if (value.hasOwnProperty("align")) {
74+
value.hozAlign = value.align;
75+
delete value.align;
76+
}
7277

7378
// all others leave unchanged
7479
return value;
75-
}
76-
);
80+
});
7781

7882
var mid = (dark) ? "_midnight" : "";
7983
var html = String.raw`
@@ -84,7 +88,7 @@ module.exports = function (RED) {
8488
<input type='hidden' ng-init='init(` + configAsJson + `)'>
8589
`;
8690
return html;
87-
};
91+
}
8892

8993
function TableNode(config) {
9094
var done = null;
@@ -211,8 +215,7 @@ module.exports = function (RED) {
211215
if (opts.columns && Array.isArray(opts.columns) && opts.columns.length>0) {
212216
opts.autoColumns = false;
213217
}
214-
// console.log("createTabulator",opts);
215-
if($scope.table !== undefined) {
218+
if ($scope.table !== undefined) {
216219
$scope.table.destroy();
217220
}
218221
$scope.table = new Tabulator(basediv, opts);
@@ -236,9 +239,7 @@ module.exports = function (RED) {
236239
}, 200); // lowest setting on my side ... still fails sometimes ;)
237240
};
238241
$scope.$watch('msg', function (msg) {
239-
//console.log("ui-table message arrived:",msg);
240242
if (msg && msg.hasOwnProperty("ui_control") && msg.ui_control.hasOwnProperty("callback")) return msg; // to avoid loopback from callbacks. No better solution jet. Help needed.
241-
//console.log("ui-table msg: ", msg);
242243

243244
// configuration via ui_control
244245
if (msg && msg.hasOwnProperty("ui_control")) {
@@ -248,7 +249,7 @@ module.exports = function (RED) {
248249
String.prototype.parseFunction = function () {
249250
var funcReg = /function *\(([^()]*)\)[ \n\t]*{(.*)}/gmi;
250251
var match = funcReg.exec(this.replace(/\n/g, ' '));
251-
if(match) {
252+
if (match) {
252253
return new Function(match[1].split(','), match[2]);
253254
}
254255
return null;

node-red-node-ui-table/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-node-ui-table",
3-
"version": "0.4.1",
3+
"version": "0.4.2-beta",
44
"description": "Table UI widget node for Node-RED Dashboard",
55
"author": "Kazuhito Yokoi",
66
"contributors": ["Dave Conway-Jones","@hotNipi","@Christian-Me"],

0 commit comments

Comments
 (0)