Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Possible to use Popover/OptionDialog with table row in iPad?

Hi all the experts out there,

I am trying to use OptionDialog or Popover with table row and I couldn't get it to work. The idea is to create a table of items, and when the user selects one of it, an OptionDialog (or Popover) will show up with the arrow pointing to that row.

For OptionDialog, the emulator will crash if I have


I also tried setting the view parameter to the label inside the row and it also crashed.

If I remove view:tableviewrow from the function, the dialog box will show up but there is no arrow pointing to the selected row. It will show up in the center of the screen.

I than tried using Popover and has similar result.

Is it not possible to do this? Any idea?

Thanks a lot in advance!

— asked May 15th 2010 by Joel Yen
  • ipad
  • optiondialog
  • popover

3 Answers

  • I have a workaround:

    Just add an invisible view to the clicked row in the the tableview’s click event. And that newly created view can be used as source for the popover.

    tableView.addEventListener('click', function(e) 
       //create the popover here
      //create the "hidden" view where the arrow points to
       var b1 = Ti.UI.createView({
          title:"", height:20, width:1, top:0, right:200
      //add the view to the clicked row
       //now this should work
    — answered October 11th 2010 by Sebastian
    • Hopefully this issue will be fixed in a new release soon. This definitely works in the meantime.

      — commented December 2nd 2010 by Michael Szul
    • fantastic idea, thank you for that Sebastian!

      — commented December 31st 2010 by Jim Carter III
  • Don't know if someone is still having the problem but right now with the postLayout event there is a way to fix the popover misplacement. Moreover we can take care of removing the extra view we created in the row:

                //let's create our extra view
                var view = Ti.UI.createView({ ... });
                //add it to our row
                //only when the extra view is rendered we create our popOver : 
                function displayPopOver(){
                view.removeEventListener('postlayout', displayPopOver);
                var popover = Ti.UI.iPad.createPopover({
                        width: 400, 
                        height: 550,
                        title: 'Detail',
                //when popOver disappears remove the extraView
                popover.addEventListener('hide',function(evt) { e.row.remove(view)})
            } // end displayPopOver()
    — answered November 3rd 2012 by Vince
  • I am having the same issue. I get an error saying that the view must belong to a window.

    — answered September 27th 2010 by Drew Bowman
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.