- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-07-2021 02:02 AM
The Problem
I found myself coming back to making some form of a table with buttons to act on the data quite often and tended to end up throwing together a table widget to handle that specific case and had meant to create a more reusable table to which I could tie data.
The issue that usually came up was applying logic to the data that was present and offering some sort of selection of symbols or buttons (usually both) to the rendered table, making use of the out-of-the-box table widget either out of the question or much more difficult.
In a recent whirl of development, I finally made an abstracted table that could take data from a client callable script include, so as to allow development of a custom data source without requiring modification of the widget's server-side script. In making it, I planned to make it a bit more general and worked out some basic guide rails for working with a REST API or leveraging the usual server-side script.
Quick Overview
The goal was to be able to create a script that assembled some data and then have a table that was easily configured for semi-robust data display while offering configurable buttons to act on the rows. This widget handles this with 2 instance configurations for JSON strings, one to define the columns and one to define actions:
The widget then uses these to loop over the generic objects provided by the client script and render a table, rows, and give the user some basic abilities to flip through pages and filter the data:
The widget has quite a few instance options aimed at providing a fair amount of control as well as an option to simply deactivate it for when something quickly needs hidden with the intention of bringing it back at some point with ease.
Sharing
I've attached the update set for the widget below as well as placing it on the Developer Share site and GitHub for anyone to check out, use, and leave feedback or requests. The Widget satisfies our current needs but definitely has room to grow (Row selection likely being the next feature to get added):
Developer Share: https://developer.servicenow.com/connect.do#!/share/contents/5258606_action_table
GitHub: https://github.com/alexanderson-sedgwick/action-table
Documentation: https://alexanderson-sedgwick.github.io/action-table/