I have a consolidated collection. I use fetch({add:true})
to retrieve new items from my server and add them to the collection.
I linked the listener function to add
event collections. Id like this function to get the index at which the item was added to the collection.
The base script documentation for Collection.add
says: "If you are a callback listening for the "add"
event, options.index
tells you the index at which the model is added to the collection."
Ive recorded the arguments that seem to be passed to my console function on the console and looked at them. As far as I can tell, the first argument is the added item, followed by a temporary collection object created to store it when it returns from the server. I don't seem to have an object with the index
property.
How can I get the index at which the item was added to the collection?
source share