mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-26 11:21:08 +00:00
extend the treenode to provide a method to allow for updating colum values
This commit is contained in:
parent
7462a5e1d8
commit
63427a18cc
@ -226,11 +226,11 @@ Deluge.Details.Files = {
|
||||
walk(item, child);
|
||||
} else {
|
||||
if (!child) {
|
||||
child = new Ext.tree.TreeNode({
|
||||
child = new Ext.tree.ColumnTreeNode({
|
||||
id: file,
|
||||
filename: file,
|
||||
text: file, // this needs to be here for sorting
|
||||
size: fsize(item[0]),
|
||||
size: item[0],
|
||||
progress: item[1],
|
||||
priority: item[2],
|
||||
leaf: true,
|
||||
@ -239,6 +239,9 @@ Deluge.Details.Files = {
|
||||
});
|
||||
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'),
|
||||
width: 150,
|
||||
dataIndex: 'size'
|
||||
dataIndex: 'size',
|
||||
renderer: fsize
|
||||
},{
|
||||
header: _('Progress'),
|
||||
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, {
|
||||
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){
|
||||
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.ecNode = cs[1];
|
||||
this.iconNode = cs[2];
|
||||
this.anchor = cs[3];
|
||||
this.textNode = cs[3].firstChild;
|
||||
var index = 3;
|
||||
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…
x
Reference in New Issue
Block a user