[TIMOB-19526] ListView - setting "allowsSelection" to "false" disables "itemclick" event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2019-12-09T23:24:27.000+0000 |
Affected Version/s | Release 4.1.1 |
Fix Version/s | n/a |
Components | n/a |
Labels | TCSupportTriage, engTriage |
Reporter | Ivan Skugor |
Assignee | Unknown |
Created | 2014-09-09T10:06:51.000+0000 |
Updated | 2019-12-09T23:24:27.000+0000 |
Description
When "allowsSelection" is set to "false" (which means, rows should not show color which means they are selected), "itemclick" event is not fired. I think that is wrong, selection is one thing, clicking on whole list view is whole other thing and it should not be affected by "allowsSelection" property.
To see this issue, run this code:
var win = Ti.UI.createWindow({backgroundColor: 'white', top: 20});
var listView = Ti.UI.createListView({
allowsSelection: false
});
var sections = [];
var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
{properties: { title: 'Apple'}},
{properties: { title: 'Banana'}},
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables'});
var vegDataSet = [
{properties: { title: 'Carrots'}},
{properties: { title: 'Potatoes'}},
];
vegSection.setItems(vegDataSet);
sections.push(vegSection);
listView.setSections(sections);
listView.addEventListener('itemclick', function(e) {
alert(e);
});
win.add(listView);
win.open();
Click on some row - you should not see alert dialog (and IMO you should).
While the ticket title is true, the solution is to have allowsSelection=true and set
for every ListViewItem.
Ahh, that workaround is hard to notice, thanks for pointing it out!
Closing as "Won't fix. when setting *allowsSelection* to *false* itemclick events will not fire. This is by design.