mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
extend the treenode to provide a method to allow for updating colum values
This commit is contained in:
parent
7462a5e1d8
commit
63427a18cc
2 changed files with 38 additions and 5 deletions
|
@ -226,11 +226,11 @@ Deluge.Details.Files = {
|
||||||
walk(item, child);
|
walk(item, child);
|
||||||
} else {
|
} else {
|
||||||
if (!child) {
|
if (!child) {
|
||||||
child = new Ext.tree.TreeNode({
|
child = new Ext.tree.ColumnTreeNode({
|
||||||
id: file,
|
id: file,
|
||||||
filename: file,
|
filename: file,
|
||||||
text: file, // this needs to be here for sorting
|
text: file, // this needs to be here for sorting
|
||||||
size: fsize(item[0]),
|
size: item[0],
|
||||||
progress: item[1],
|
progress: item[1],
|
||||||
priority: item[2],
|
priority: item[2],
|
||||||
leaf: true,
|
leaf: true,
|
||||||
|
@ -239,6 +239,9 @@ Deluge.Details.Files = {
|
||||||
});
|
});
|
||||||
parent.appendChild(child);
|
parent.appendChild(child);
|
||||||
}
|
}
|
||||||
|
child.setColumnValue(1, item[0]);
|
||||||
|
child.setColumnValue(2, item[1]);
|
||||||
|
child.setColumnValue(3, item[2]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -370,7 +373,8 @@ Deluge.Details.Panel = new Ext.TabPanel({
|
||||||
},{
|
},{
|
||||||
header: _('Size'),
|
header: _('Size'),
|
||||||
width: 150,
|
width: 150,
|
||||||
dataIndex: 'size'
|
dataIndex: 'size',
|
||||||
|
renderer: fsize
|
||||||
},{
|
},{
|
||||||
header: _('Progress'),
|
header: _('Progress'),
|
||||||
width: 150,
|
width: 150,
|
||||||
|
|
|
@ -84,8 +84,27 @@ Ext.tree.ColumnTree = Ext.extend(Ext.tree.TreePanel, {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Ext.tree.ColumnTreeNode = Ext.extend(Ext.tree.TreeNode, {
|
||||||
|
|
||||||
|
setColumnValue: function(index, value) {
|
||||||
|
var t = this.getOwnerTree();
|
||||||
|
var oldValue = this[t.columns[index].dataIndex];
|
||||||
|
if (this.rendered) {
|
||||||
|
this.ui.onColumnValueChange(this, index, value, oldValue);
|
||||||
|
}
|
||||||
|
this.fireEvent('columnvaluechange', this, index, value, oldValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Ext.tree.ColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
|
Ext.tree.ColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
|
||||||
focus: Ext.emptyFn, // prevent odd scrolling behavior
|
focus: Ext.emptyFn, // prevent odd scrolling behavior
|
||||||
|
|
||||||
|
onColumnValueChange: function(n, colIndex, value, oldValue) {
|
||||||
|
if (this.rendered) {
|
||||||
|
var c = n.getOwnerTree().columns[colIndex];
|
||||||
|
this.columnNodes[colIndex].innerHTML = (c.renderer ? c.renderer(value, n, null) : value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
renderElements : function(n, a, targetNode, bulkRender){
|
renderElements : function(n, a, targetNode, bulkRender){
|
||||||
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
|
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
|
||||||
|
@ -134,8 +153,18 @@ Ext.tree.ColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
|
||||||
this.indentNode = cs[0];
|
this.indentNode = cs[0];
|
||||||
this.ecNode = cs[1];
|
this.ecNode = cs[1];
|
||||||
this.iconNode = cs[2];
|
this.iconNode = cs[2];
|
||||||
this.anchor = cs[3];
|
var index = 3;
|
||||||
this.textNode = cs[3].firstChild;
|
if(cb){
|
||||||
|
this.checkbox = cs[3];
|
||||||
|
// fix for IE6
|
||||||
|
this.checkbox.defaultChecked = this.checkbox.checked;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
this.anchor = cs[index];
|
||||||
|
this.columnNodes = [cs[index].firstChild];
|
||||||
|
for(var i = 1, len = cols.length; i < len; i++){
|
||||||
|
this.columnNodes[i] = this.elNode.childNodes[i].firstChild;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue