[AC-688] Windows Phone App Listview Crash
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Resolved |
| Resolution | Cannot Reproduce |
| Resolution Date | 2016-03-10T09:20:27.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | windows, windows_phone |
| Reporter | Parmeet Singh |
| Assignee | Shak Hossain |
| Created | 2016-02-20T11:33:47.000+0000 |
| Updated | 2016-03-10T09:20:27.000+0000 |
Description
Well i m facing an issue of weird crash on Listview on Windows device (Works well on windows emulator)
It crashes when the Listview is about to be assigned a section
$.timeLineList.sections = [section];
Please help me with this issue, its really urgent For further reference i am providing the appropriate xml and JS code too:
XML Code:
<ListView id="timeLineList" defaultItemTemplate="template" backgroundColor="transparent">
<Templates>
<ItemTemplate name="template" height="Ti.UI.SIZE" separatorColor="red" backgroundColor="transparent">
<View class="groupView" >
<ImageView bindId="pic" class="pic"></ImageView>
<View layout="vertical" class="parentView">
<Label class="name" bindId="name"></Label>
<Label class="info" bindId="info"></Label>
<View layout="horizontal">
<Label class="date" bindId="date"></Label>
</View>
</View>
<View class="commentView">
<Label class="comments" bindId="comments"></Label>
</View>
</View>
<View class="border"></View>
</ItemTemplate>
</Templates>
<ListSection id="timeline"></ListSection>
</ListView>
JS Code:
for (var i = 0; i < _response.length; i++) {
Ti.App.Properties.setString('timelineId', _response[i].id);
if (_response[i].postType == "1") {
data.push({
pic : {
image : "images/icons/homeScreenIcons/ViewResponses.png"
},
info : {
text : "Sent to: " + _response[i].sendTo
},
name : {
text : _response[i].post
},
date : {
text : _response[i].updatedAtDate
},
comments : {
//text: "146 comments"
text : _response[i].commentCount + " comments"
},
properties : {
name : _response[i].post,
info : "Sent to: " + _response[i].sendTo,
date : _response[i].updatedAtDate,
id : _response[i].id,
postType : _response[i].postType,
comments : _response[i].commentCount + " comments",
image : "images/icons/homeScreenIcons/ViewResponses.png"
}
});
} else if (_response[i].postType == "2") {
var tag = new Array();
tag = _response[i].image.split(',');
Ti.API.info("Tags array: " + tag[0]);
data.push({
pic : {
image : "images/icons/homeScreenIcons/ViewPhotoComment.png"
},
info : {
text : "Sent to: " + _response[i].sendTo
},
name : {
text : _response[i].post
},
date : {
text : _response[i].updatedAtDate
},
comments : {
//text: "146 comments"
text : _response[i].commentCount + " comments"
},
properties : {
name : _response[i].post,
info : "Sent to: " + _response[i].sendTo,
date : _response[i].updatedAtDate,
id : _response[i].id,
postType : _response[i].postType,
comments : _response[i].commentCount,
image : tag
}
});
} else {
data.push({
pic : {
image : "images/icons/homeScreenIcons/PollResult.png"
},
name : {
text : _response[i].post
},
info : {
text : "Sent to: " + _response[i].sendTo
},
date : {
text : _response[i].updatedAtDate
},
comments : {
text : _response[i].commentCount + " Respondents"
},
properties : {
name : _response[i].post,
info : "Sent to: " + _response[i].sendTo,
date : _response[i].updatedAtDate,
id : _response[i].id,
values : _response[i].pollValues,
comments : _response[i].commentCount,
privacy : _response[i].pollPrivacy,
expiration : _response[i].postExpiration
}
});
}
var _timelineDb = Alloy.createModel('timeline', {
id : _response[i].id,
post : _response[i].post,
postType : _response[i].postType,
tags : _response[i].tags,
userGroupId : _response[i].userGroupId,
badgeCount : _response[i].badgeCount,
createdAtDate : _response[i].createdAtDate,
updatedAtDate : _response[i].updatedAtDate,
createdAt : _response[i].createdAt,
updatedAt : _response[i].updatedAt,
image : _response[i].image ? _response[i].image : "",
commentCount : _response[i].commentCount,
sendTo : _response[i].sendTo
});
timelineDbCollection.add(_timelineDb);
_timelineDb.save();
}
Ti.API.info('timelineDbCollection:' + JSON.stringify(Alloy.Collections.timeline.toJSON(), null, 2));
var section = Ti.UI.createListSection({
items : data
});
$.timeLineList.sections = [section];
Hello, Thanks for your report. We tried to run your provided test case but it didn't work on our end. A minimal reproducible test case would help. We would be happy to investigate this issue further once we have a minimal reproducible test case. However we tried to reproduce the issue with the following test case. But no crash occurred on our end. ListView is working as expected. *Testing Environment:* Appcelerator Command-Line Interface, version 5.2.0 Appcelerator Studio, build: 4.5.0.201602170821 SDK : 5.1.2 GA Windows Phone OS : 8.1 *Test Case:* index.xml
*index.js*<Alloy> <Window> <ListView id="timeLineList" defaultItemTemplate="template"> <!-- The Templates tag sets the ListView's templates property --> <Templates> <ItemTemplate name="template"> <ImageView bindId="pic" id="icon" /> <Label bindId="info" id="title" /> <Label bindId="es_info" id="subtitle" /> </ItemTemplate> </Templates> <ListSection name="elements" /> </ListView> </Window> </Alloy>*Steps to test:* 1. Create an alloy project 2. Replace index.xml and index.js with the sample test case above 3. Run the app Regardsvar data = []; for (var i = 0; i < 30; i++) { data.push({ properties : { backgroundColor : (i % 2) ? '#44112233' : 'transparent', }, }); } var section = Ti.UI.createListSection({ items : data }); $.timeLineList.sections = [section]; $.index.open();