From: <ga...@us...> - 2010-11-24 22:49:58
|
Revision: 4897 http://jaffa.svn.sourceforge.net/jaffa/?rev=4897&view=rev Author: gautamj Date: 2010-11-24 22:49:52 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Optimized the loadRecords() function in TreeGridStores.js to bunch all newly created rows in a single 'add' event, rather than firing a separate event for each row. This greatly speeds up rendering, especially when displaying hundreds of records. Modified Paths: -------------- branches/JAFFA_5_7_RELEASE/JaffaRIA/source/html/js/extjs/ux/maximgb/treegrid/TreeGridStores.js Modified: branches/JAFFA_5_7_RELEASE/JaffaRIA/source/html/js/extjs/ux/maximgb/treegrid/TreeGridStores.js =================================================================== --- branches/JAFFA_5_7_RELEASE/JaffaRIA/source/html/js/extjs/ux/maximgb/treegrid/TreeGridStores.js 2010-11-24 20:57:04 UTC (rev 4896) +++ branches/JAFFA_5_7_RELEASE/JaffaRIA/source/html/js/extjs/ux/maximgb/treegrid/TreeGridStores.js 2010-11-24 22:49:52 UTC (rev 4897) @@ -208,15 +208,16 @@ this.removeNodeDescendants(loaded_node); } this.suspendEvents(); - updated = {}; + updated = null; for (i = 0, len = r.length; i < len; i++) { record = r[i]; idx = this.indexOfId(record.id); if (idx == -1) { - updated[record.id] = false; this.add(record); } else { + if (!updated) + updated = {}; updated[record.id] = true; prev_record = this.getAt(idx); prev_record.reject(); @@ -239,15 +240,18 @@ return result; }); - for (i = 0, len = r.length; i < len; i++) { - record = r[i]; - if (updated[record.id] == true) { - this.fireEvent('update', this, record, Ext.data.Record.COMMIT); + if (updated) { + for (i = 0, len = r.length; i < len; i++) { + record = r[i]; + if (updated[record.id] == true) { + this.fireEvent('update', this, record, Ext.data.Record.COMMIT); + } + else { + this.fireEvent("add", this, [record], this.data.indexOf(record)); + } } - else { - this.fireEvent("add", this, [record], this.data.indexOf(record)); - } - } + } else + this.fireEvent("add", this, r, this.data.indexOf(r[0])); } this.fireEvent("load", this, r, options); if (options.callback) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |