Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1869] Android: Implement TableView.selectRow

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-11-12T20:18:03.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-16 API, Release 3.0.0, Release 3.1.0, 2012 Sprint 21 API, 2012 Sprint 21
ComponentsAndroid
Labelsapi, module_tableview, parity, qe-and100112, qe-review, qe-testadded, triage
ReporterDon Thorp
AssigneePing Wang
Created2011-04-15T03:04:22.000+0000
Updated2013-04-29T16:44:22.000+0000

Description

See http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.TableView.selectRow-method.html

Comments

  1. Anirudh Nagesh 2012-07-23

    HD ticket: appc.me/c/APP-612663
  2. Anirudh Nagesh 2012-08-03

    PR: https://github.com/appcelerator/titanium_mobile/pull/2674
  3. Anirudh Nagesh 2012-08-03

    Test Case:
       var win = Ti.UI.createWindow({
       	backgroundColor:'black',
       	//height:'auto',
       	top:0
       
       });
       
       var data = [];
       
       for (var i = 0; i<15 ; i++)
       {
       	data[i] = Ti.UI.createTableViewRow({hasCheck:true,title:'Row'+i,color:'orange',font:{fontFamily:'Roman',fontWeight:'bold',fontSize:20}});
       }
       
       
       // create table view
       var tableview = Titanium.UI.createTableView({
       	data:data
       });
       
       win.add(tableview);	 
       
       var b1 = Ti.UI.createButton({
       	 title : 'Click Me',
       	 height : 'auto',
       	 width : 'auto'
        });
         
         win.add(b1);
       
       b1.addEventListener('click', function(e){
       tableview.selectRow(7);
       });
       
       win.open();
       
  4. Vishal Duggal 2012-08-10

    PR https://github.com/appcelerator/titanium_mobile/pull/2674
  5. Satyam Sekhri 2012-08-30

    The behaviour on iOS and Android for TableView.selectRow are different. On Android the selected row is shown at the top of the screen whereas on iOS it is shown selected with blue background color. Verified on: Titanium Studio: 2.1.2.201208281351 Titanium SDK: 2.2.0.v20120828153312
  6. Tamila Smolich 2012-10-15

    Reopening issue. TableView.selectRow does not work on Android, but works fine on iOS. Tested and verified on: OS: Mac OS X Lion 10.7.4 Titanium Studio, build: 3.0.0.201210090117 Titanium SDK, build: 3.0.0.v20121014234610 Device: Nexus 7 (4.1.2)
  7. Vishal Duggal 2012-10-17

    Please read documentation attached. From docs - Sets the currently selected item. If in touch mode, the item will not be selected but it will still be positioned appropriately. If the specified selection position is less than 0, then the item at position 0 will be selected. The method only guarantees that the selected row will be visible on the screen. Modify the test case to add maybe 200 rows and try selecting something off the screen. The row should be visible on screen.
  8. Tamila Smolich 2012-10-17

    Expecting behavior is shown with modified test case. Closing the bug.
  9. Ping Wang 2012-11-12

    This fix is already in 3_0_X branch. So removed the label merge-3.0.0.
  10. Ping Wang 2012-11-12

    Reopen to modify the label.
  11. Rafael Kellermann Streit 2013-04-29

    How can I change the background of selected rows? selectedBackgroundColor is not working here (3.1.0.GA).
  12. Ping Wang 2013-04-29

    Hi Rafael Kellermann Streit, calling tableview.selectRow(int) does not mean the row is selected. From the [doc](http://developer.android.com/reference/android/widget/ListView.html#setSelection(int)): {quote} If in touch mode, the item will not be selected but it will still be positioned appropriately. {quote} That's why selectedBackgroundColor is not shown in this case.
  13. Rafael Kellermann Streit 2013-04-29

    Hi Ping, thanks for your answer. How can I select a row changing the backgroundColor? Is it possible?

JSON Source