[ALOY-1102] Module for ListView is not working when using SDK 3.2.3
GitHub Issue | n/a |
Type | Bug |
Priority | Medium |
Status | Resolved |
Resolution | Won't Fix |
Resolution Date | 2014-10-23T19:07:07.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | XML |
Labels | n/a |
Reporter | Davide Cassenti |
Assignee | Tim Poulsen |
Created | 2014-07-31T08:29:34.000+0000 |
Updated | 2014-10-23T20:15:04.000+0000 |
Description
Description
Following ticket ALOY-1082 I tried to create a module for ListView. While the code (pasted below) works fine using SDK 3.3.0.GA, an error is thrown when building with 3.2.3.GA.
Code
Code as proposed by [~skypanther] is the following:
lib/customlist.js
var ListView = function(args) {
this.view = Ti.UI.createListView(args);
}
ListView.prototype.addMeASectionPlease = function(items) {
var section = Ti.UI.createListSection();
section.setItems(items);
return this.view.appendSection(section);
}
ListView.prototype.getView = function() {
return this.view;
}
exports.createListView = function(args) {
return new ListView(args);
};
index.xml
<Alloy>
<Window>
<Label text="Add section" top="20" id="addButton"/>
<ListView module="customlist" top="50" id="mylist" defaultItemTemplate="template">
<Templates>
<ItemTemplate name="template">
<Label bindId="myLabel" class="myLabel"></Label>
</ItemTemplate>
</Templates>
</ListView>
</Window>
</Alloy>
index.js
$.addButton.addEventListener('click', function() {
var items = [
{myLabel: {text:'Foo'}, template:'template', properties: {backgroundColor: 'purple'}},
{myLabel: {text:'Bar'}, template:'template'},
{myLabel: {text:'Baz'}, template:'template'}
];
$.mylist.addMeASectionPlease(items);
})
$.index.open();
Error
Following the error when running the app on iOS Simulator:
[ERROR] : Script Error {
[ERROR] : backtrace = "#0 () at file:///Users/USER/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/CFCEF8AE-346F-4338-AE45-9BF2B447D10B/AlloyTestListView.app/alloy.js:231";
[ERROR] : line = 59;
[ERROR] : message = "-[__NSDictionaryM krollObjectForBridge:]: unrecognized selector sent to instance 0xce8e420";
[ERROR] : sourceId = 301971840;
[ERROR] : sourceURL = "file:///Users/USER/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/CFCEF8AE-346F-4338-AE45-9BF2B447D10B/AlloyTestListView.app/alloy/controllers/index.js";
[ERROR] : }
Comments
- Tim Poulsen 2014-10-23
This works in SDK 3.3.0.GA and 3.4.0.GA, hence closing as won't fix.
JSON Source