Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1636] Collection.get returns null when searching by cid

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2015-09-30T03:27:00.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Titanium SDK & CLI
Labelsandroid, backbone, ios, titanium
ReporterAndrés Franco
AssigneeShak Hossain
Created2015-05-19T19:17:52.000+0000
Updated2016-03-08T07:38:07.000+0000

Description

Hi, i got this error on Titanium SDK 4.0.0RC4 and RC5. It happens when you try to get a model on a collection by cid/id, how Backbone deprecated the use of getByCid we have to go this way, but this method is returning null always. Collection.get('c1') === null. A test case can be:
Alloy.Collections.cars.reset([{'make':'Honda'}, {'make':'Ford'}]);

// Imagine that we want to get an item by the 'cid' that backbone creates for each item in the collection.
// So if we do that, it returns null. Im using right now getByCid but on Titanium SDK 3.5.1.G.A 
// and it works but since Backbone deprecate it.. we have to use the get directly on 4.0.0RC4/5
// If you try to replicate this behaviour with Backbone itself, you´ll see how it works but not on Alloy actually. 
Alloy.Collections.cars.get('c1');
Thanks

Comments

  1. Harish Mridha 2015-05-20

    Hi, Please include a test case .That will be really helpful to address your issue. Thanks
  2. Andrés Franco 2015-05-20

    I attached an example. I hope it helps!
  3. Rakhi Mitro 2015-09-02

    Hi, I tested the issue you reported. I can't reproduce it.I tested this using the studio build: 4.1.1.201507141126,Titanium SDK Version:4.1.0.GA,Appcelerator Command-Line Interface, version 4.1.2,alloy 1.7.6 and Node.js Version 0.10.20.I recommend you upgrade SDK to the latest build and let us know if you get the error again. Please include a proper test case and steps to reproduce. Thanks

JSON Source