# Re-Order Power Table Rows using Buttons

**URL:** <https://forum.inductiveautomation.com/t/re-order-power-table-rows-using-buttons/17978>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [May 9, 2018, 8:18pm UTC](https://forum.inductiveautomation.com/t/re-order-power-table-rows-using-buttons/17978 "2018-05-09T20:18:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://forum.inductiveautomation.com/u/Stuart)\
**Post date:** [May 9, 2018, 8:18pm UTC](https://forum.inductiveautomation.com/t/re-order-power-table-rows-using-buttons/17978/1 "2018-05-09T20:18:52Z")

</div>

I have a Power Table populated by a database query, and I wanted to be able to re-order the rows using buttons next to the table. The idea is that the user will click on a row, and then use the Up/Down arrows to move that selected row, up or down the table. The selected row will stay selected after being moved.

Here is what I came up with. 7.9.7. [ReorderRow.proj](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e33b121c17efde55420f677796e13723242e512c.proj) (11.3 KB)  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/336c7145b607b0dc4ac4fe221ecdef7c308855cb.PNG)

I am using a column in the database/table to store the order, and you can see in my scripting where I am updating the value in that column. This step could have probably been ignored, and the database update inserted in it’s place, but I wanted to try and keep things seperated.

This example should still work without a database, just remove the section at the end of each button.

Did I just reinvent the wheel, and can this be accomplished an easier way?
