Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1425] iOS : iPad cannot show a popover with tableView as its contentView

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2014-06-27T23:17:04.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsios
ReporterDavid He
AssigneeMauro Parra-Miranda
Created2014-06-23T12:37:53.000+0000
Updated2016-03-08T07:37:51.000+0000

Description

Code snippet below shows the problem - {color:red}Unable to display popover; view is not attached to the current window{color}
var win = Ti.UI.createWindow();

var table = Ti.UI.createTableView({
	rowHeight : 40
});

var row = Ti.UI.createTableViewRow({

});

var tf = Ti.UI.createTextField({
	hintText : "Title",
	left : 5,
	right : 5,
	editable : false
});

row.add(tf);

table.setData([row]);

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.contentView = Ti.UI.createTableView({
		data : [{
			title : "Mr."
		}, {
			title : "Dr."
		}, {
			title : "Ms."
		}, {
			title : "Mrs."
		}],
		rowHeight : 40
	});
	//popover.show({view:e.source});
	popover.show();

});

win.add(table);

win.open();

Comments

  1. Mauro Parra-Miranda 2014-06-27

  2. David He 2014-06-28

    Why is this ticket closed??? IT IS NOT RESOLVED IN SDK 3.2.3. Did you not see my environment????
  3. David He 2014-06-28

    Also, this ticket is different the one you mentioned, my one is trying to set the tableview to the contentView attribute
  4. Mauro Parra-Miranda 2014-06-29

    Hello [~jialhe85@gmail.com], I did some testing like this:
       var win = Ti.UI.createWindow();
       
       var button = Ti.UI.createButton({title: 'Open Popover!'});
       button.addEventListener('click', function(e){
           popover.show({ view: button });
       });
       win.add(button);
       
       var view = Ti.UI.createView({backgroundColor: 'green'});
       var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];
       
       var table = Ti.UI.createTableView({
         data: tableData
       });
       
       view.add(table);
       
       var popover = Ti.UI.iPad.createPopover({
           width: 250,
           height: 100,
           title: 'Kermit',
           //rightNavButton: rightButton
       });
       popover.add(view);
       
       win.open();
       
    and works just fine with 3.3.0.Beta. Best, Mauro
  5. David He 2014-06-29

    Thanks Mauro I will re-test it using 3.3.0 beta

JSON Source