Fixed some errors on the tree node detail controller

This commit is contained in:
Alejandro Gallardo Escobar 2015-01-08 18:23:01 +01:00
parent 32b5415a07
commit b21d4d6f5a
1 changed files with 13 additions and 13 deletions

View File

@ -638,6 +638,16 @@ TreeNodeDetailController = {
var $content = $("<div></div>"); var $content = $("<div></div>");
$content.addClass("tree-element-detail-content"); $content.addClass("tree-element-detail-content");
// Container
this.container = $("<div></div>");
this.container
.addClass("tree-element-detail")
.append($label)
.data('label', $label)
.append($content)
.data('content', $content)
.hide();
$label.addClass('tree-element-detail-loading'); $label.addClass('tree-element-detail-loading');
$.ajax({ $.ajax({
url: this.ajaxURL, url: this.ajaxURL,
@ -655,7 +665,8 @@ TreeNodeDetailController = {
success: function(data, textStatus, xhr) { success: function(data, textStatus, xhr) {
if (data.success) { if (data.success) {
$label.addClass('tree-element-detail-loaded'); $label.addClass('tree-element-detail-loaded');
$content.append(data.html); $content.html(data.html);
controller.open(); controller.open();
} }
else { else {
@ -669,17 +680,6 @@ TreeNodeDetailController = {
} }
}); });
// Container
this.container = $("<div></div>");
this.container
.addClass("tree-element-detail")
.append($label)
.data('label', $label)
.append($content)
.data('content', $content)
.hide();
this.recipient.append(this.container); this.recipient.append(this.container);
this.open(); this.open();
}, },
@ -734,7 +734,7 @@ TreeNodeDetailController = {
return false; return false;
} }
// Required // Required
if (typeof data.id != 'undefined' && data.id.length > 0) { if (typeof data.id != 'undefined' && (data.id.length > 0 || !isNaN(data.id))) {
this.id = data.id; this.id = data.id;
} }
else { else {