# Right Click Popup on Power Table Not Working

**URL:** <https://forum.inductiveautomation.com/t/right-click-popup-on-power-table-not-working/11978>\
**Category:** Ignition\
**Created:** [July 27, 2016, 1:54pm UTC](https://forum.inductiveautomation.com/t/right-click-popup-on-power-table-not-working/11978 "2016-07-27T13:54:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dginther94](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@dginther94](https://forum.inductiveautomation.com/u/dginther94)\
**Post date:** [July 27, 2016, 1:54pm UTC](https://forum.inductiveautomation.com/t/right-click-popup-on-power-table-not-working/11978/1 "2016-07-27T13:54:19Z")

</div>

Hey all,

New to Ignition here in these recent couple weeks, and I’m at a loss for ideas as to why my power table suddenly stopped allowing me to right click it, when it’s the same as two others in different windows, and the windows are also largely the same with the same references (the other two allow me to right click them).

What’s supposed to happen is you right click anywhere in the table and it brings up an option to export to spreadsheet (xls format). I know, however, that specifically, the code for exporting to excel itself works because I also have that inside a button to the side. For some reason, the small popup won’t appear at all.

Here is the code I have in the Script Editor in the Mouse Release event for the Power Table:

```auto
def exportXLS(event):
	from java.util import Date
	tableName = event.source.parent.getComponent('TableName').text
	now = Date()
	date = system.db.dateFormat(now,"MM-dd-yyyy")
	file = tableName + " " + date
	data = event.source.data
	dataCol = data.getColumnName(0)
	noInfo = "No information found."
	if(dataCol == noInfo):
		system.gui.messageBox("There is no information to export!","Export Failed")
	else:
		system.dataset.exportExcel(file,True,data)
	
menu = system.gui.createPopupMenu(["Export to Spreadsheet"], [exportXLS])
menu.show(event)
```

A little stumped here, and any help/suggestions are appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 27, 2016, 10:20pm UTC](https://forum.inductiveautomation.com/t/right-click-popup-on-power-table-not-working/11978/2 "2016-07-27T22:20:32Z")

</div>

Is there any particular reason you’re using the MouseRelease event, rather than the onPopupTrigger extension function?

Dropping your exact code into the onPopupTrigger function worked perfectly (a right click displayed the Export option) for me.

---

<div class="post-metadata">

**Author:** ![LSimao](https://avatars.discourse-cdn.com/v4/letter/l/d2c977/32.png) [@LSimao](https://forum.inductiveautomation.com/u/LSimao)\
**Post date:** [August 3, 2020, 2:07pm UTC](https://forum.inductiveautomation.com/t/right-click-popup-on-power-table-not-working/11978/3 "2020-08-03T14:07:22Z")

</div>

Hello Paul

Sorry about this grave digging message: I tried your suggestion (using it in onPopupTrigger) but I get the following error:

```auto
Traceback (most recent call last):

  File "<extension-method onPopupTrigger>", line 27, in exportXLS

TypeError: getComponent(): 1st arg can't be coerced to int

```

Line 27 in my case is the following

```auto
	tableName = event.source.parent.getComponent('TableName').text

```

I’m using a powertable and created the ‘text’ property. Would you be able to help me identify my mistake?

Thanks!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 3, 2020, 3:41pm UTC](https://forum.inductiveautomation.com/t/right-click-popup-on-power-table-not-working/11978/4 "2020-08-03T15:41:01Z")

</div>

Well, the short answer is that you don’t need an `event.source.parent` - if you’re already in an extension method, there’s a `self` reference back to the originating component.

The long answer has to do with Java Swing’s internals:  
`event.source.parent`, from a table, refers to the component itself. The `getComponent(<name>)` function is only a method on _Ignition_’s container types - otherwise, you have to use the underlying Java swing method [`Container.getComponent`](https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Container.html#getComponent(int)), which only accepts integers as arguments - each child of a container (and every Java Swing component is a container) is indexed.

---

<div class="post-metadata">

**Author:** ![LSimao](https://avatars.discourse-cdn.com/v4/letter/l/d2c977/32.png) [@LSimao](https://forum.inductiveautomation.com/u/LSimao)\
**Post date:** [August 3, 2020, 3:58pm UTC](https://forum.inductiveautomation.com/t/right-click-popup-on-power-table-not-working/11978/5 "2020-08-03T15:58:00Z")

</div>

Thanks Paul, everything’s working now 🤜 🤛
