Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15428] IOS: iPad Popover can't be associated to a TableViewRow

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-03-17T20:19:07.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 06, 2014 Sprint 06 SDK, Release 3.2.3, Release 3.3.0
ComponentsiOS
Labelsios6, ios7, ipad, module_popover, popover, qe-closed-3.2.3, qe-testadded, tableViewRow
ReporterVincent
AssigneeVishal Duggal
Created2013-10-03T18:50:48.000+0000
Updated2014-07-28T17:17:21.000+0000

Description

Trying to display a popover from a tableViewRow fails with the following message in the console "Unable to display popover; view is not attached to the current window" TEST CASE:
var win = Ti.UI.createWindow();

var section = Ti.UI.createTableViewSection();

for (var i=1; i < 5; i++) {
	section.add(Ti.UI.createTableViewRow({
		title:'Row '+i
	}));
}

var table = Ti.UI.createTableView({
 
  data:[section]
});

table.addEventListener('click', function(e){
	
	Ti.API.info('You clicked row '+e.index);
	Ti.API.info('source '+e.source);
	
	Ti.API.info(JSON.stringify(e.row));
	
	
	var popover = Ti.UI.iPad.createPopover({
   	 	width: 250,
    	height: 100,
    	title: 'a POpover',
    
	});
	
	
	//popover.show({view:e.source});
	popover.show({view:e.row});
	
});


win.add(table);


var splitwin = Ti.UI.iPad.createSplitWindow({
    detailView: Ti.UI.createWindow({backgroundColor:'red'}),
    masterView: win,
    
    orientationModes :[Ti.UI.LANDSCAPE_LEFT],
});


splitwin.open();

Comments

  1. Vincent 2013-10-04

    check in TiUIiPadPopOver.m -(void)updatePopoverNow in this case we are receiving a TiUITableViewRowProxy and the view property is nil for this kind of proxy. quick and dirty fix : search for the UItableViewCell contentView inside the TableViewRowProxy. So, to get the view in case of a TiUITableViewRowProxy I added in -(void)updatePopoverNow around line 289
       ....
       
       UIView *view_ = [popoverView view];
       
       // special case for tableViewRowProxy
       
       if ([popoverView  isKindOfClass:[TiUITableViewRowProxy class]]) {
                  
                  TiUITableViewRowProxy* proxy = (TiUITableViewRowProxy*) popoverView;
                   
               
                   view_= [proxy.callbackCell contentView];
               
                   
               }
       
       // end special case for tableViewRowProxy
       
       
       if ([view_ window] == nil) {
       			// No window, so we can't display the popover...
       			DebugLog(@"[WARN] Unable to display popover; view is not attached to the current window");
                   return;
       		}
       ....
       
  2. Vincent 2013-12-26

    I can't believe this problem exist for 4 years now .. http://developer.appcelerator.com/question/25961/possible-to-use-popoveroptiondialog-with-table-row-in-ipad
  3. Ingo Muschenetz 2013-12-26

    We currently have this scheduled to be fixed in 3.2.1.
  4. Vishal Duggal 2014-03-14

    Pulls pending master - https://github.com/appcelerator/titanium_mobile/pull/5468 3_2_X - https://github.com/appcelerator/titanium_mobile/pull/5469
  5. Olga Romero 2014-03-18

    Tested and verified the fix with: Appcelerator Studio, build: 3.2.3.201403171239 Titanium SDK, build: 3.2.3.v20140317142455 Node.JS Version: v0.10.13 NPM Version: 1.3.2 ├── acs@1.0.14 ├── alloy@1.3.1 ├── npm@1.3.2 ├── titanium@3.2.1 └── titanium-code-processor@1.1.0 Device:iPad iOS 7.0.3 Popover can be associated to a TableViewRow.

JSON Source