Introduction
Overview
The datatable component has two main components:
- The backend support for the datatable which provide metadata and data to the datatable. The metadata includes the columns, the data type of each column, and the filter options for each column as well as the GraphQL query to fetch the data.
- Name: The name of the datatable. This is used to identify the datatable in the backend. This must be unique as it is used to fetch the data from the backend.
- Schema: The GraphQL schema of the datatable.
- Custom: Selecting custom will use the custom schema.
- OOTB: Selecting OOTB will use the OOTB schema such as GlideRecord_Query
- Filter Builder: This is a javascript function that will evaluate to return a ServiceNow encoded query string.
- There two parameters to this function:
current
: This is the current GraphQL Query Broker GlideRecord object.params
: This is the parameters object coming from the URL query string on the frontend.
- There two parameters to this function:
- GQL: The GraphQL query to fetch the data from the backend.
- Script: The javascript function to define the metadata of the datatable.
- function:
current
: This is the current GraphQL Query Broker GlideRecord object.params
: This is the parameters object coming from the URL query string on the frontend.
- function:
- Record Script: Record Script: This is the client side javascript function that will support actions from the individual field of each of the record when the datatable is rendered.
- This function has two parameters:
record
: This is the record object.service
: This is the client side service used to interact with the backend.- The service provides the following methods:
call(methodName, parameters, pageId)
: Call a server-side methodsearch(query)
: Update URL query parametersnavigateToPage(pageId, queryParams)
: Navigate to another pagenavigate(url)
: Navigate to a URLsnackbar(message)
: Show a snackbar messageshowLoading()
: Show loading indicatorhideLoading()
: Hide loading indicatorconfirm(message)
: Show a confirmation dialogpostAsync(url, payload)
: Make a POST requestgetAsync(url)
: Make a GET requestgraphQlAsync(query)
: Execute a GraphQL query
- The service provides the following methods:
- This function has two parameters:
- The datatable filter component