# JMenuItem elements resulting from a query and that seems like a table

**URL:** <https://forum.inductiveautomation.com/t/jmenuitem-elements-resulting-from-a-query-and-that-seems-like-a-table/30794>\
**Category:** Ignition\
**Tags:** ignition79, ignition80, vision, scripting\
**Created:** [December 18, 2019, 8:37am UTC](https://forum.inductiveautomation.com/t/jmenuitem-elements-resulting-from-a-query-and-that-seems-like-a-table/30794 "2019-12-18T08:37:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giulio.comito](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/giulio.comito/32/12671_2.png) [@giulio.comito](https://forum.inductiveautomation.com/u/giulio.comito)\
**Post date:** [December 18, 2019, 8:37am UTC](https://forum.inductiveautomation.com/t/jmenuitem-elements-resulting-from-a-query-and-that-seems-like-a-table/30794/1 "2019-12-18T08:37:27Z")

</div>

Hello everyone! I created a script that opens a popup below the clicked row (JMenuItem) …  
I would like to know basically two things:

1. Can the items displayed in the popup be the result of a query?
2. Is it possible to add rows and columns to the popup in the photo?

 ![Cattura1](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/5ac48025e0dacc55b3b8f7ac986363206719ce4a.png)

---

<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:** [December 18, 2019, 4:30pm UTC](https://forum.inductiveautomation.com/t/jmenuitem-elements-resulting-from-a-query-and-that-seems-like-a-table/30794/2 "2019-12-18T16:30:01Z")

</div>

> [@giulio.comito](#):
>
> 1. Can the items displayed in the popup be the result of a query?
> 2. Is it possible to add rows and columns to the popup in the photo?

1. Yes, but be careful running queries - they can take an indeterminate amount of time, so running them via scripting is a good way to lock up the event dispatch thread. You should probably run your query in a custom property or something similar, then filter the results with a script.
2. Not really, or at least not easily. To render a table-like structure, you're probably going to need to literally create a table, which means you're entirely outside the expected behavior of JMenuItems. It'll entirely involve your own custom scripting, and you'll need to import your own swing objects to render.

---

<div class="post-metadata">

**Author:** ![giulio.comito](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/giulio.comito/32/12671_2.png) [@giulio.comito](https://forum.inductiveautomation.com/u/giulio.comito)\
**Post date:** [December 18, 2019, 4:46pm UTC](https://forum.inductiveautomation.com/t/jmenuitem-elements-resulting-from-a-query-and-that-seems-like-a-table/30794/3 "2019-12-18T16:46:33Z")

</div>

![Cattura2](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b9f4935fef1bfafb74087447fc69c487c0fbec17.png)  
I solved it in this way … It seems to work fine! Now my doubt is if I can add a working button (JButton) inside the table. Could you give me a working script of a JButton on table?  
Thanks!  
GC
