[TIMOB-23734] Windows: section updateItemAt updates wrong item
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-12T01:55:39.000+0000 |
Affected Version/s | Release 5.4.0 |
Fix Version/s | Release 6.0.0 |
Components | Windows |
Labels | listView, qe-5.4.0, windowsphone |
Reporter | Zakhar Zhuravlev |
Assignee | Gary Mathews |
Created | 2016-08-04T09:39:49.000+0000 |
Updated | 2016-08-17T16:13:54.000+0000 |
Description
affect version - 5_4_X 5.4.0.v20160802165655
*index.js:*
function onUpdate() {
$.section.updateItemAt(1, {info: {text: 'update'}});
}
$.section.appendItems([
{info: {text: 'title 1'}},
{info: {text: 'title 2'}},
{info: {text: 'title 3'}}
]);
$.win.open();
*index.xml:*
<Alloy>
<Window id="win" backgroundColor='black'>
<ListView id="list" defaultItemTemplate="template">
<Templates>
<ItemTemplate name="template">
<Label bindId="info" id="title" />
</ItemTemplate>
</Templates>
<ListSection id='section' />
</ListView>
<Button width='100dp' height='50dp' bottom="50dp" backgroundColor='red' onClick='onUpdate' />
</Window>
</Alloy>
in 5_4_X 5.4.0.v20160802165655 updates 2nd elem instead of 1st.
in 5.3.0 working fine
Reopening as a 5.4.0 regression for now, [~gmathews] already looks into it. Thanks!
I cannot reproduce the issue, this test case seems to work fine *TEST CASE #1*
*Please note that the item index starts at 0, the first item in the list is at index 0 and not index 1.*
Of course, I know that array index starts from 0. Your example works for me!! But you don't use .xml file. Try MY example! MY EXAMPLE DOESN'T WORK CORRECTLY!!!!
I can confirm that this is a valid bug. with [~gmathews]'s test code, the correct item is updated (set to 1, second item in the list). But with [~zozo4kin]'s test code: *updateItemAt 0:* Second item is updated. *updateItemAt 1:* Third item is updated. *updateItemAt 2:* Runtime Error: Exception Unknown. Seems that the indexing is being read incorrectly with Alloy Projects. Tested on: Windows 10 Pro Windows Phone 10.0 (Microsoft Lumia 640 LTE) Appc Studio: 4.7.0.201607250649 Ti SDK: 5.4.0.v20160804185318 Appc NPM: 4.2.7 Appc Core: 5.4.0-40 Node: v4.4.4 *Reopening Ticket.*
Ah, the problem was the inclusion of a
headerTitle
. Apologies. *TEST CASE #2*master: https://github.com/appcelerator/titanium_mobile_windows/pull/808 5_4_X: https://github.com/appcelerator/titanium_mobile_windows/pull/809
Verified using: Windows 10 Pro Appc core: 5.4.0-40 Appc NPM: 4.2.7 Ti SDK: 5.4.0.v20160809033140 Lumia 930: 10.0 Lumia 520: 8.1 When calling section.updateItemAt on a section with no header the correct item is now updated Closing ticket
IT IS NOT WORKING FOR 0 index! try update item at 0 index and ypu will get exception: message: "invalid vector
[~zozo4kin] Thanks. I'll reopen this ticket. Windows 10 Pro Appc core: 5.4.0-40 Appc NPM: 4.2.7 Ti SDK: 5.4.0.v20160809033140
master: https://github.com/appcelerator/titanium_mobile_windows/pull/813
Why 6.0.0 ? =((( It's very critical bug, I'm waiting for it. It was working in 5.3.0 and 5.3.1....
[~zozo4kin] We just released 5.4.0.GA today and the ticket was just raised this week. After it is merged, it needs to go through our quality engineering to be tested in detail. The next possible release therefore is 6.0.0, but you can still apply the PR manually to your SDK and patch it. Please see our guides on how to do that, thanks!
Verified using: Windows 10 Pro Appc core: 6.0.0-26 Appc NPM: 4.2.8-5 Ti SDK: 6.0.0.v20160817065403 updateItemAt now updates the correct item and no longer errors on index 0 when not using headerTitle. Closing ticket