Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11275] iOS: Click event is fired even when click is outside the icon of an item in the Titanium.UI.DashboardView

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-11-14T00:06:33.000+0000
Affected Version/sRelease 2.1.3
Fix Version/sRelease 2.1.4, Release 3.0.0, Release 3.1.0, 2012 Sprint 21 API, 2012 Sprint 21
ComponentsiOS
Labelsmodule_dashboardview, qe-review, qe-testadded
ReporterDavide Cassenti
AssigneeVishal Duggal
Created2012-10-05T15:35:32.000+0000
Updated2012-12-27T18:21:03.000+0000

Description

Problem description

When the icon that represents an item inside a DashboardView is smaller than the "cell" size, clicking outside the icon fires the 'click' event.

Steps to reproduce

- Use the following code:
var win = Ti.UI.createWindow({
    backgroundColor: '#444'
});

var dashboardData = [];
var itemData = [
  { name: 'account', badge: 10 },
  { name: 'cases', badge: 2 },
  { name: 'calls', badge: 2 },
  { name: 'contacts', badge: 5},
  { name: 'emps' }, 
  { name: 'leads' },
  { name: 'meetings', badge: 3 },
  { name: 'opps',  badge:  126 }, // badge will be displayed as "99+"
  { name: 'tasks' }
];

for (var i=0, ilen=itemData.length; i<ilen; i++){
  var item = Ti.UI.createDashboardItem({
    badge: itemData[i].badge,
    image: '/images/test.png',
    label: itemData[i].name
  });
  dashboardData.push(item);
}

var dashboard = Ti.UI.createDashboardView({
  data: dashboardData,
  wobble: true
});
win.add(dashboard);

dashboard.addEventListener('click', function(e){
  alert('Fired on ' + e.location.x +  ' ' + e.location.y + '!');
});

win.open();
- Make sure the icons used are smaller than the cell size - Run the app and click outside the icon: the click event is fired

Note

The x-y value returned in the click event is fixed for each element, no metter where the user clicks. In particular, first element is always 0-0, second 256-0, third 512-0 etc.

Comments

  1. Vishal Duggal 2012-10-17

    PR pending https://github.com/appcelerator/titanium_mobile/pull/3265
  2. Vishal Duggal 2012-10-17

    3_0_X PR https://github.com/appcelerator/titanium_mobile/pull/3271
  3. Ingo Muschenetz 2012-10-18

    Need backport PR for 2.1.X branch.
  4. Vishal Duggal 2012-10-18

    New PR for master https://github.com/appcelerator/titanium_mobile/pull/3272 New PR for 3_0_X https://github.com/appcelerator/titanium_mobile/pull/3273
  5. Vishal Duggal 2012-10-24

    PR for 2_1_X https://github.com/appcelerator/titanium_mobile/pull/3315
  6. Natalie Huynh 2012-11-01

    Tested with 2.1.4.v20121030173408 on iPhone 4s 6.0
  7. Ingo Muschenetz 2012-11-14

    We hadn't removed the 3.0.1 FixVersion.

JSON Source