[ADD] ability to close an opened group, fix disposal of list (don't blow up if already disposed of), improve disposal of group body elements
bzr revid: xmo@openerp.com-20110520133045-l2gqs8sxso5rqt4k
This commit is contained in:
parent
2a04eef03b
commit
6ea547dc71
|
@ -449,6 +449,7 @@ openerp.base.ListView.List = Class.extend( /** @lends openerp.base.ListView.List
|
||||||
* Death signal, cleans up list
|
* Death signal, cleans up list
|
||||||
*/
|
*/
|
||||||
apoptosis: function () {
|
apoptosis: function () {
|
||||||
|
if (!this.$current) { return; }
|
||||||
this.$current.remove();
|
this.$current.remove();
|
||||||
this.$current = null;
|
this.$current = null;
|
||||||
}
|
}
|
||||||
|
@ -531,7 +532,16 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr
|
||||||
var placeholder = this.make_fragment();
|
var placeholder = this.make_fragment();
|
||||||
_(datagroups).each(function (group) {
|
_(datagroups).each(function (group) {
|
||||||
var $row = $('<tr>').click(function (e) {
|
var $row = $('<tr>').click(function (e) {
|
||||||
self.open_group(e, group);
|
if (!$row.data('open')) {
|
||||||
|
$row.data('open', true);
|
||||||
|
self.open_group(e, group);
|
||||||
|
} else {
|
||||||
|
$row.removeData('open')
|
||||||
|
.find('span.ui-icon')
|
||||||
|
.removeClass('ui-icon-triangle-1-s')
|
||||||
|
.addClass('ui-icon-triangle-1-e');
|
||||||
|
_(self.children).each(function (child) {child.apoptosis();});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
placeholder.appendChild($row[0]);
|
placeholder.appendChild($row[0]);
|
||||||
self.pad($row);
|
self.pad($row);
|
||||||
|
@ -650,9 +660,7 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr
|
||||||
_(this.children).each(function (child) {
|
_(this.children).each(function (child) {
|
||||||
child.apoptosis();
|
child.apoptosis();
|
||||||
});
|
});
|
||||||
$(this.elements).each(function (i, body) {
|
$(this.elements).remove();
|
||||||
$(body).remove();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue