1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

EditableList api calls must not return nested list items

This commit is contained in:
Nick O'Leary 2020-04-27 11:04:41 +01:00
parent 2eaea02489
commit 0150769c17
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -183,7 +183,7 @@
if (this.options.resizeItem) { if (this.options.resizeItem) {
var that = this; var that = this;
this.element.children().each(function(i) { this.element.children().each(function(i) {
that.options.resizeItem($(this).find(".red-ui-editableList-item-content"),i); that.options.resizeItem($(this).children(".red-ui-editableList-item-content"),i);
}); });
} }
}, },
@ -223,7 +223,7 @@
var items = this.element.children(); var items = this.element.children();
var that = this; var that = this;
items.sort(function(A,B) { items.sort(function(A,B) {
return that.activeSort($(A).find(".red-ui-editableList-item-content").data('data'),$(B).find(".red-ui-editableList-item-content").data('data')); return that.activeSort($(A).children(".red-ui-editableList-item-content").data('data'),$(B).children(".red-ui-editableList-item-content").data('data'));
}); });
$.each(items,function(idx,li) { $.each(items,function(idx,li) {
that.element.append(li); that.element.append(li);
@ -305,7 +305,7 @@
} }
if (this.options.addItem) { if (this.options.addItem) {
var index = that.element.children().length-1; var index = that.element.children().length-1;
setTimeout(function() { // setTimeout(function() {
that.options.addItem(row,index,data); that.options.addItem(row,index,data);
if (that.activeFilter) { if (that.activeFilter) {
try { try {
@ -321,7 +321,7 @@
that.uiContainer.scrollTop(that.element.height()); that.uiContainer.scrollTop(that.element.height());
},0); },0);
} }
},0); // },0);
} }
}, },
addItem: function(data) { addItem: function(data) {
@ -334,7 +334,7 @@
}, },
removeItem: function(data) { removeItem: function(data) {
var items = this.element.children().filter(function(f) { var items = this.element.children().filter(function(f) {
return data === $(this).find(".red-ui-editableList-item-content").data('data'); return data === $(this).children(".red-ui-editableList-item-content").data('data');
}); });
items.remove(); items.remove();
if (this.options.removeItem) { if (this.options.removeItem) {
@ -342,7 +342,7 @@
} }
}, },
items: function() { items: function() {
return this.element.children().map(function(i) { return $(this).find(".red-ui-editableList-item-content"); }); return this.element.children().map(function(i) { return $(this).children(".red-ui-editableList-item-content"); });
}, },
empty: function() { empty: function() {
this.element.empty(); this.element.empty();
@ -365,14 +365,14 @@
}, },
show: function(item) { show: function(item) {
var items = this.element.children().filter(function(f) { var items = this.element.children().filter(function(f) {
return item === $(this).find(".red-ui-editableList-item-content").data('data'); return item === $(this).children(".red-ui-editableList-item-content").data('data');
}); });
if (items.length > 0) { if (items.length > 0) {
this.uiContainer.scrollTop(this.uiContainer.scrollTop()+items.position().top) this.uiContainer.scrollTop(this.uiContainer.scrollTop()+items.position().top)
} }
}, },
getItem: function(li) { getItem: function(li) {
var el = li.find(".red-ui-editableList-item-content"); var el = li.children(".red-ui-editableList-item-content");
if (el.length) { if (el.length) {
return el.data('data'); return el.data('data');
} else { } else {