PDA

View Full Version : 4.2.x store add problem



vpciii
4 Aug 2013, 5:55 PM
I'm trying to add items to a data store using the add method. In all previous versions 4.x versions prior to 4.2, this would work:


myStr.add({id: id, msg: msg, index: index});

However since switching to 4.2.x, the add method only seems to overwrite the first element in the store so that there is only ever one element even though multiple calls to add have been made. In 4.1.1 it works correctly as well as 4.0.7 and the additional records are added to the store.

I'm unsure how to proceed. Did the add mechanism change between versions and I need a code or configuration change to get the store to work as it used to?

Thanks

evant
4 Aug 2013, 7:37 PM
The id needs to be unique. This has always been the case, though it may have sort-of worked in older versions. In this case, if you're using "duplicate" id's, then you can either:

1) Change the idProperty on the model so it doesn't point to "id".
2) Use some other field on the model other than id to hold this value.

vpciii
5 Aug 2013, 3:10 AM
That was the problem, changing the model to user err_id instead of id resolved it. Thanks!