-
30 Jan 2013 5:55 AM #1
Why new nodes are registered by their internalId's only ?
Why new nodes are registered by their internalId's only ?
I was investigating some bug that appeared after switching from 4.1.3 to 4.2 regarding Tree structures, and I've found this change in the source:
4.1.3
4.2Code:registerNode : function(node, includeChildren) { var me = this; me.nodeHash[node.getId() || node.internalId] = node; (...) }
I'm wondering what is the advantage of the second approach ? In this case finding nodes by Id's won't work anymore. What if I'm adding a node with know Id and I want to reference it after adding to the structure ? I'm not considering this a bug but rather I'm interested what was the idea behind this change.Code:registerNode : function(node, includeChildren) { var me = this, children, length, i; me.nodeHash[node.internalId] = node; (...) },Using ExtGantt / ExtScheduler from Bryntum ? I can help you integrate and implement it.
-
1 Feb 2013 11:48 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 434
I think we were moving to have 2 maps, one for internal id and the other for user defined but I have opened a bug in our bug tracker to make sure this gets look at.
-
3 Feb 2013 3:35 PM #3
The internalId of a model will be set appropriately if you pass an id to it:
There's also code to handle the id on the model being changed so it can notify any interested parties, which will be part of the next release.Code:Ext.define('Foo', { extend: 'Ext.data.Model', fields: ['id', 'name'] }); Ext.onReady(function(){ var a = new Foo({ id: 1 }); var b = new Foo(); console.log(a.internalId, b.internalId); // Logs 1 "ext-record-1" });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
You found a bug! We've classified it as
EXTJSIV-8493
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote