-
13 Feb 2013 6:53 AM #1
store.add() does nothing
store.add() does nothing
given
(a store)Code:mystore
No error reported.Code:console.log(mystore.getCount()) // == 4 store.add(model); console.log(mystore.getCount()) // == 4
== a revert back to 4.1 (which works)
-
13 Feb 2013 7:27 AM #2
-
13 Feb 2013 8:12 AM #3
I have boiled it down to the fact that I am adding two objects with the same "unassigned" Id of "0"
Its zero as it will get assigned an id by the server on update. If I update it to be "null" then it works ok. Like I said this was unnecessary with 4.1 so it's a breaking change.
Code:var rs = Ext.create("Pegfect.model.profile.ResponseSet"); var m1 = Ext.create("Pegfect.model.profile.Response", { Id: null}); var m2 = Ext.create("Pegfect.model.profile.Response", { Id: null }); var hc = [m1, m2]; rs.responses().removeAll(); rs.responses().add(hc); console.log("hc arr:" + hc.length); //==2 console.log("hc rs:" + rs.responses().getCount()); //==2Code:var rs = Ext.create("Pegfect.model.profile.ResponseSet"); var m1 = Ext.create("Pegfect.model.profile.Response", { Id: 0}); var m2 = Ext.create("Pegfect.model.profile.Response", { Id: 0}); var hc = [m1, m2]; rs.responses().removeAll(); rs.responses().add(hc); console.log("hc arr:" + hc.length); //==2 console.log("hc rs:" + rs.responses().getCount()); //==1
-
13 Feb 2013 1:13 PM #4
This is something we won't be fixing. As you suggested, there's a difference between 0 & null. Users have pointed out that 0, although typically not used as an identifier, still represents an explicitly assigned value for an id, so it should be treated as a non-phantom value. Null/undefined values still are treated as phantoms and as such are assigned their own default identifiers.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
14 Feb 2013 12:25 AM #5
imo the rules as to what makes a record new or existing should not be hard-coded into the framework.
isNew() config function perhaps?
Would you consider putting that in your release notes so that others don't have to find out the hard way?
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote