Hi everyone,
I need some assistance with implementing an approval process in Ignition Perspective. I currently have a popup that displays a list of approvers in a table, showing the sequence, status, and time of their approvals (see screenshot below).
What I Need:
I want to add Approve and Reject buttons next to each approver in the table, allowing the user to click on either button to approve or reject a specific approver. The table should then refresh to display the updated status for that particular approver.
Challenges:
- I'm not sure how to properly add Approve and Reject buttons for each row.
- I need help with scripting the action for the buttons to update the status in the database.
- The table needs to refresh dynamically after the approval or rejection is done.
If anyone has experience with something similar or can point me in the right direction, I would greatly appreciate it! I'm especially looking for advice on the best approach for adding buttons in the table and handling the actions.
Thanks in advance for your help!
This is confusing! Why would you allow a user to reject or approve and approver? It seems backwards. Surely an approver-user (I'm trying to avoid confusion here) should open the popup which will show the current status and give options appropriate for that approver-user's role. e.g., If someone with Supervisor privileges is logged in they should be able to change anything up to their level of authorisation.
Anyway, model your design on a website that works well and has a clear and consistent user interface. There are two ways that might work for you.
- Add buttons to rows and set their enabled or visible properties based on roles.
- Allow the user to select a row and then enable / disable the Approve and Reject buttons at the bottom of the view based on their role.
In both cases the Approve button should be disabled if already approved and Cancel button disabled if it hasn't been approved yet.
Then you're going to have a script to update the database and refresh the data binding on the table in your popup. It won't be complicated. Finally, when closing the popup you'll use a message handler to trigger a refresh on the table in the main view.
Share how you are populating the popup's table.
Comments:
- Should "Operated" read "Operator"?
- Create a Perspective style class "paddingLR" and set the padding on the left and right to 5 pixels or so. Then apply that to each column. e.g.,
columns.0.style.classes : paddingLR
It prevents text getting jammed up against the edges of the table and allows it to breath!
- The use of a checkbox in the Status column is slightly confusing. I'd expect to be able to toggle it. Text "Pending", "Approved" and "Rejected" might be less ambiguous.
2 Likes