这是我正在做的更新treegrid中的所有子节点。更新子节点会导致刷新每行的视图,这似乎会减慢检查复选框的更新过程。
我尝试过使用ext.suspendLayout,component.suspendlayout,component.suspendEvents但没有性能提升。当检查父节点时,需要检查大约80个子节点。完成此操作大约需要4秒钟。
[HTML]
//code for checkbox that is recursively updated.
return Ext.create("Ext.form.field.Checkbox", {
checked: checked,
record: record,
name: "Enabled",
fieldCls: record.data.nodeLevel != 2 ? (checked == 1 ? "checkBlue" : (checked == 2 ? "checkBlack" : '')) : "",
hideable: false,
xtype: 'checkbox',
name: "TreeCheckStatus",
handler: function (checkbox, checked) {
page.gridPanel.suspendEvents();
Ext.defer(function () { record.set("TreeCheckStatus", getTriStatevalue(record)); }, 1);
//recursive function to update all child notes records
updateAllChild(record, getTriStatevalue(record));
page.gridPanel.resumeEvents(true);
}
});
}
//recursive method to update all the nodes
function updateAllChild(record, value) {
if (record.hasChildNodes()) {
// page.gridPanel.suspendLayouts();
var childParentStatus = true;
Ext.each(record.childNodes, function (rec) {
rec.beginEdit();
rec.set("TreeCheckStatus", value);
updateAllChild(rec, value);
rec.endEdit();
});
}
}[/HTML]![enter image description here][1]