Chapter 4 Salient Process Toolkits Unabridged
Chapter 4 Salient Process Toolkits Unabridged
Organization
Chapter 4: SPARK UI Toolkit – Unabridged
Authors:
Eric Ducos (Salient Process)
Matthew Oatts (Salient Process)
John McDonald (Salient Process)
Reviewers:
Dennis Parrott (IBM)
Claudio Tagliabue (IBM)
Brian French (Salient)
Note: This is the Unabridged version of the SPARK material (Chapter 4) from the IBM BPM Redbook:
Deliver Modern UI for IBM BPM with the Coach Framework. We encourage all readers to take advantage
of the material in the full Redbook! The information contained in this Unabridged SPARK version
includes everything from Chapter 4 of the Redbook plus additional SPARK guidance.
4.2 Introduction
The SPARK UI Toolkit is an IBM BPM UI toolkit created by Salient Process, a Premier
IBM Business Partner specializing in IBM Smarter Process consulting services and
innovation.
IBM and Salient Process have partnered together to make the SPARK UI Toolkit the UI
toolkit of choice for IBM BPM customers. There are already efforts underway to
incorporate the SPARK UI Toolkit into the IBM BPM product as of the time of this
Redbook's publication. For more information on this partnership and future plans for the
SPARK UI Toolkit and IBM BPM UI, see Section 4.3 below.
There is a comprehensive deep dive beginning in Section 4.4 of this Chapter that starts
with simple core concepts and builds upon that foundation to explain all there is to know
about the developing UI with the SPARK UI toolkit.
Note: While UI developers are encouraged to read the Chapter in its entirety to truly
become experts, it is recommended that all developers using SPARK should at least read
Section 4.4 to take advantage of key benefits of the SPARK UI Toolkit
The SPARK External Participant Toolkit can extend the reach of IBM BPM to include
external participants (see Chapter 6 of full Redbook)
Controls on a page or a view can easily refer to and talk to each other
Each control can react to all sorts of events (on click, on key press, on tab change, on
timeout, on row deleted, etc.) and business logic can intuitively be expressed and
attached to those events to create an interactive end-user experience
Reliance on data binding is optional. This eliminates complexity and "glue" artifacts
commonly associated with BPM UIs. A data binding is only needed when a control
needs to synchronize with meaningful business data
The enhanced SPARK UI development approach is designed after a well-known effective
and efficient development model of controls composed on a canvas with properties,
methods and events. The complexity stops there and all properties, methods, and
events are well documented per control.
When the values of controls/fields on a form are computationally related (whether
numerical or not), Excel-like formulas can be used to automatically calculate and
update values (in single fields or tables) on a page/view without having to write code
Note: BPM UI development can become much more effective and efficient by exploiting
the Coach Framework programming model enhancements provided by the SPARK UI
Toolkit, and the resulting solutions are consistently more lightweight, more
maintainable, and more reusable.
1
See SPARK UI documentation and articles at https://support.salientprocess.com/spark-ui-controls/
Once the four core SPARK UI patterns are understood, the extent of a developer's effort
is to look up the capabilities (configuration options, events, and methods) of controls that
may not have been used before, and exploit those capabilities to implement business
requirements. Because all controls follow a strictly consistent approach across the four
core patterns, gaining familiarity with a new control is a simple and predictable
experience.
NOTE: The SPARK UI Toolkit requires a web browser with comprehensive support for
HTML5 and CSS3.
IBM BPM is a constantly evolving platform. The introduction of new features can be
valuable to some and disruptive to others, especially when a new feature entails the
deprecation of an older one.
While SPARK takes full advantage of the latest IBM BPM product capabilities (for
example, SPARK-based UIs in Client-Side Human Services can use the full SPARK
programming model right from Client-Side scripts to access page controls and
manipulate them), the toolkit also attempts - as much as possible - to normalize the
experience across BPM product versions.
It does so by relying on constructs that remain consistent from one product version to the
next (for example SPARK-based UIs can be virtually Heritage or Client-Side Human
service-agnostic). By design, the toolkit works consistently across BPM 8.5.0.1 through
BPM 8.5.7 and is jointly planned by IBM and Salient Process to be fully incorporated into
the IBM BPM product.
Formula: Used for the value computation of the control (more on formulas later in this
chapter)
Behavior: General behavior-related control-specific options
Appearance: Options including styling, coloring, layout, typography, labeling
Performance: Options to manage processing-intensive behaviors in repeating controls
such as tables and layouts for large data sets
Responsive: View width-sensitive settings that automatically adjust layout and
appearance of a control based on the view that contains it (conventional page width-
based adaptive configuration options are also available through the IBM Process
Designer Web Editor)
Events: Used to attached logic to various events specific to a control (more on events in
the next Events section)
The above example should look very intuitive to UI developers because it's simple and
familiar, and it focuses on the problem - namely in this case: In the "on-click" event of a
button, access another control and make it do things using calls to methods.
Methods
All SPARK controls have methods. Getters, setters and various action methods (for
example to change the color of a button, to set the title of a panel, to expand a collapsible
section, to refresh a table backed by AJAX, to make an image visible, and so on)
Example 2 shows how some methods simply abstract certain Coach Framework-specific
constructs:
Or
text1.setText("Text set from button: " + button1.getText())
Other methods are specific to particular SPARK controls and have no counterpart in the
Coach Framework. As shown in Example 3:
All SPARK controls provide documented methods and can be accessed from the SPARK
support site2.
Figure 3 shows a few methods for the Button control:
2
Check https://support.salientprocess.com/spark-ui-controls/, then the JSDoc link for each control
Events
Events are key to interactivity in the SPARK UI Toolkit. They allow controls to respond to
user, device, and various programmatic triggers.
Examples of actions triggered by events could include:
An alert displayed when a button is clicked
Validation performed when an item in a drop-down list is selected
An AJAX service fetching data when a collapsible panel is expanded
A chart refreshed when a popup menu item is tapped
A label updated with a new value every time a timer ticks
A table filters its content when a user types search text
An output text displaying a result when an AJAX service returns
For a more compact and convenient notation in inline event logic, SPARK UI controls can
be referred to in shorthand using the ${<control-id>} notation. The inline event logic
shown in Figure 4 can be rewritten as in the notation shown in Figure 5:
Tip: Don't confuse the ${control-id} reference lookup notation with the jQuery
$("<selector>") notation. The SPARK UI Toolkit doesn't depend on jQuery (though it can
peacefully coexist with it).
Table 2 shows the context variables that the Text > On Input event provides to the inline
event logic:
Table 2 Context variables for the Text > On Input event
Variable name Description
me Similar to the "this" concept: Refers to the control that emitted the
event
view Refers to the control's first parent view that is not merely decorative
(often this means the composite Coach View that contains the control)
current Text content in the control prior to the change from the input
potential Attempted content - will become the new text content unless the logic
returns false
selection Location of cursor in text control or boundaries of the selection if text
was selected and replaced by new content
The JS Doc for each control (see the JS Doc links for each control in the online SPARK
control reference) details not only the methods but also the events supported by the
control and their associated context variables as appropriate.
Because these variables are common to all controls, they are never explicitly mentioned
in the JSDoc as context variables.
A key benefit a reusable Coach Views should include the ability to encapsulate not only
the child views laid out on the containing view's canvas, but also their behavior. The
Hint: Full Coach View encapsulation is a very significant benefit of the SPARK UI Toolkit.
Don't miss the following part!
Figure 10 shows how the "Calculate" button now calls a calculate() function defined in the
containing composite Coach View [view.calculate()], not at the page-level:
The definition of the "Calculator" composite Coach View's calculate() function is shown in
Figure 11:
Note: In a very simple step, non-reusable code (at the page level) was made reusable.
The Calculator Coach View relies on no external scripts or components to perform its
work.
This is, in the author's opinion, the fastest and most intuitive general approach to building
truly reusable Coach Views.
Note: While using many boundary events to execute business logic is easily doable with
SPARK (as shown above), boundary events can clutter the Client-Side Human Service
In the author's opinion, the less "mixed" the SPARK approach, the more streamlined the
solution, and the more productive the BPM UI developer.
Events - summary
Handlers for a multitude of events are available on SPARK controls. Logic can be run
from any of those event handlers by calling methods on controls.
Event logic can be inlined or a function defined globally, or in a control's containing
composite view, can be called.
Functions to be called in the parent composite Coach View can be defined in the view's
Inline JavaScript section (see the Coach View's Behavior tab in IBM Process Designer)
as suggested in Example 4:
Example 4 Event-callable function defined in composite Coach View
—————————————————————————————————————————————————————————————————
this.myFunction = function(<parameters if needed>) {
/* Business logic... */
}
—————————————————————————————————————————————————————————————————
Example 5 shows how myFunction can be invoked from an event handler of the child
control:
Example 5 Calling a function defined in composite Coach View from a control's event handler
—————————————————————————————————————————————————————————————————
view.myFunction(<parameters if needed>)
—————————————————————————————————————————————————————————————————
${<control-id>} is a convenient way to refer to controls in inline event logic and works
consistently at the page level and in a Coach View. UI developers are encouraged to use
it.
Lastly, although BPM UI developers may be used to creating Human Service diagrams
with dense wiring and client and server scripts for business logic, the SPARK UI event
pattern combined with pertinent SPARK control methods helps minimize clutter,
increases reusability, and focuses the developer on solving the business problem.
Control referencing
Understanding how control referencing works is an important part of using the SPARK UI
Toolkit effectively.
All examples of control referencing seen so far — using the ${<control-id>} notation
or page.ui.get("<control-id>") (or view.ui.get("<control-id>")) —
have been very straightforward.
A BPM UI developer using SPARK and following standard component encapsulation
practices can be productive working with such simple kind of addressing (in addition to
working within repeating controls in tables - which is covered later in this section).
Tip: Understanding the structure and implications behind SPARK addressing can help
debug BPM UIs and exploit the programming model in creative ways to solve complex
requirements.
Control referencing works like a directory tree in the SPARK UI Toolkit (it's a view tree
instead) and the "address" of a view can include not only a control's ID but also indicators
(such as "/", "..", "[<index>]") that help navigate the view tree like a directory structure
using relative or absolute addressing.
Recap: A parent (composite) view "view1" can access an immediate child with
view1.ui.get("<child control-id>"). A view "view2" can access a sibling using
view2.ui.getSibling("<child control-id>").
Note: An inline event handler - though associated with a control - runs in the context of
the control's parent composite view (or the Coach if there is no containing composite
view). Use the "me" context variable to refer to the control emitting the event and the
"view" context variable to refer to the parent composite view.
Table 3 provides the list of controls that are considered "cosmetic" for SPARK UI
addressing:
Table 3 List of "cosmetic" SPARK controls (not inserted in a control's addressing path)
Control Notes
Caption Box Caption Box is a container that wraps around a control to add a
label or caption around it
Collapsible Panel
Deferred Section
Horizontal Layout Unless bound to a list - which makes it a repeating container
Input Group Input group is a container that wraps around a control to add a
button or icon to the left or right of the control
Modal Section
Page Layout Row Deprecated after IBM BPM 8.5.0.1
Page Layout Column Deprecated after IBM BPM 8.5.0.1
Page Layout Cell Deprecated after IBM BPM 8.5.0.1
Panel
Panel Header
Panel Footer
Popup Menu Popup menu is a container that wraps around a control to add
a popup menu to it
Stack Stack is like a tab section without any tabs or decorations
around it. It only shows one pane at a time
Status Box Status Box is a container that wraps around a control to add a
status message bubble under it
Tab Section
Table Layout Deprecated after IBM BPM 8.5.6
Table Layout Row Deprecated after IBM BPM 8.5.6
Table Layout Cell Deprecated after IBM BPM 8.5.6
Tooltip Tooltip is a container that wraps around a control to add a
tooltip to it
Vertical Layout Unless bound to a list - which makes it a repeating container
Note: The control id of Horizontal and Vertical Layout containers becomes part of the
address of the child controls they contain if the layouts are bound to a list (meaning if
they are configured as repeating containers).
Figure 17 shows the inline logic of an on-click event to update the Text control in the
fourth row of the table:
Figure 18 Event referring to Text control in table in same row as control emitting event
The runtime behavior of the two previous examples is shown in Figure 19:
Note: Achieving the same behavior, as shown in the above example, without SPARK
addressing (using classic Coach Framework capabilities) would require a much more
complicated and cumbersome approach (using "wrapper" composite coach views).
The third example in Figure 20 shows how a control in a table could refer to another
control outside the table using relative addressing:
Figure 21 Control addressing from inside to outside of repeating table - runtime behavior
More on tables and repeating containers is covered later in this chapter (see "Working
tabular and repeating data") - the purpose of this particular sub-section was only to deal
with the topic of typical addressing usage with repeating content.
Note on aliases: Many controls provide more intuitive aliases to getData or setData, for
example getText or setText for the Text control, getDate or setDate for the Date Picker
control, and so on. Regardless, getData and setData always work on controls.
Tip: Only use data bindings to update or react to changes in legitimate business data that
is part of the Human Service.
4.4.4 Validation
All SPARK UI control types that support validation visually reflect an invalid state.
However, SPARK controls that support validation do not strictly depend on the
conventional Coach Framework-based validation approach described in Chapter 2
(though they fully behave as expected with conventional validation).
The SPARK UI Toolkit and some of its controls provide support for combinations of the
following types of validation behaviors:
1. Incorrect input is prevented in the first place. In this case, the control is never in an
invalid state
2. A control allows invalid input but flags the issue while typing
3. A control allows invalid input but flags the issue after it loses focus
4. Some controls contain invalid input, but submission is prevented until errors are
resolved
5. Some controls contain invalid input, and issues are flagged after submission
Client-side validation is well-suited for cases 1, 2, 3 and 4 above (assuming the validation
needed doesn't rely on server-side rules). Server-side validation (including AJAX-based
validation) can also work well for cases 3, 4, and 5.
Figure 24 shows how this kind of behavior can be modeled with a regular expression on
the Text control:
Note: In the context of text validation, a regular expression3 is a character pattern that
defines the allowable format, characters, numbers, or symbols that can be entered in the
field.
Other controls such as Masked Text provide build-in capabilities to restrict typed content
through input "masks" - as shown in Figure 25:
3
More information on regular expressions can be accessed through this link:
https://en.wikipedia.org/wiki/Regular_expression
Programmatic validation
Although configuration-time validation can be very useful, the most flexible type of
validation is programmatic. Table 5 lists the four methods provided by the extended
SPARK programming model provides to assist with client-side validation behavior:
Note: The decision for where validation logic should run (on the client or on the server)
should be carefully evaluated and made by the solution architect. The SPARK UI toolkit
provides streamlined support for both scenarios.
The next validation scenario is identical to the previous except that the validation logic
runs in an AJAX service. The AJAX service invocation is done through the "Service Call"
SPARK control.
Instead of calling the validation logic locally, the "Amount" Decimal's "on change" event
invokes the "Validation" Service Call control, which in turn invokes the server-side
validation logic. Once the AJAX service returns, the "on result" or "on error" event of the
Service Call control is asynchronously triggered and sets the "Amount" Decimal's
validation state accordingly - as per the Figure 27 interaction sequence:
Sequence recap:
1. Data changes in the "Amount" Decimal control, which triggers the On
Change event
2. The Decimal On Change handler calls execute() on the "Validation"
Service Call control
3. The "Validation" Service Call control invokes its associated AJAX service
This scenario highlights another key benefit of the SPARK UI Toolkit: Service Call-based
invocations don't rely on a Human Service diagram. This means that both client-side logic
and server-side invocations can be fully encapsulated inside a view which takes
reusability a step further compared to a classic Coach Framework-based scenario.
Tip: Because Grid responsive behavior is always based on the width of the Coach, grids
are usually best to use in a Coach or for Coach Views that are always expected to take up
the entire width of the Coach.
SPARK UI layout controls (covered in this section) provide sophisticated and consistent
layout support for both Web and Desktop Editors in IBM Process Designer and work well
for Coaches and Coach Views, from IBM BPM 8.5.0.1 through IBM BPM 8.5.7.
Tip: The responsive behavior of SPARK UI layout controls is not relative to the Coach
Page width. This makes SPARK UI Layouts a good choice to lay out controls in a
composite Coach View (meaning a view that contains other controls).
Figure 29 lists important layout and alignment configuration parameters available for the
Horizontal and Vertical Layout controls:
By default, a margin is included around the layout (whether horizontal or vertical). Often
however (especially when a layout is nested inside of another), the UI developer may not
want a new margin added with each new level of nesting. The "Horizontal Tight" layout
option (shown above) removes the margin to allow for a more esthetically pleasing layout
appearance in such cases.
For inline scroll, content will appear properly aligned until it is compressed enough to
cause horizontal scrolling. For auto-wrapping, alignment also works predictably and the
wrapped content also aligns correctly (left, right or center).
Note: When using the "Horizontal Inline Scroll" layout option, controls that vertically
expand (such as a Popup Menu, Tooltip, Status Box) should be used with caution as the
expanded content may appear vertically cut off (the scrolling portion of the browser clips
vertically overflowing content).
Justified alignment
Justified alignment is the default alignment mode unless otherwise configured (through
the "Horizontal Alignment" option). The contained controls in a Justified-aligned layout
don't wrap overflowing content or scroll to show the overflow.
Instead, the width of the child controls can become elastic so that the entire row of
controls takes up the width of the layout (like table cells in a row). Contained controls can
have a width configured - in % or unit-based width (for example 120px, 2.9em). The
browser auto-adjusts the width of any contained control that doesn't have a width
configuration option specified.
Once the width of controls contained in a layout can be compressed no further, Figure 32
shows how the controls overflow (unless responsiveness settings override this behavior):
Note: "Justified" is not a valid horizontal alignment option for the Inline Scroll and Auto-
wrap layout options.
The Left, Center, and Right horizontal alignment options also apply for vertically flowing
layout content and the stacked control horizontal align as shown in the center-aligned
example in Figure 34:
Unless the Height of a layout is configured, the Layout control expands vertically to
accommodate showing its child content. If Height is configured and the content vertically
exceeds the height configured, then the layout automatically allows vertical scrolling - as
illustrated in Figure 35:
Setting the Height of a Layout control works predictably with any unit (for example 150px,
6.2em). However heights set using % only work if all parent elements (or layouts or
views) of the Layout control have a height specified - until either a height is specified in
units (not using %), or go all the way to the Coach body element with either % or unit-
based height specification. This is a limitation of specifying heights using CSS-based
styling.
Vertical alignment
The ability to configure a Layout control's Vertical Alignment option matters in two
situations:
1. If the height of the Layout is configured and is greater than the vertical space taken
by its content (whether the Layout flows horizontally or vertically)
2. The height of child content flowing horizontally is uneven
Nesting layouts
Horizontal or vertical layouts controls can (and should) be nested to achieve a variety of
layout behaviors. Layouts can contain other nested layouts with their own Layout Flow,
Horizontal Alignment, Vertical Alignment, Width, and Height configuration options.
These capabilities (especially when combined with responsive behavior support -
covered later) provides very powerful and flexible options for BPM UI layout at the Coach
or Coach View level.
The "Tight" (Vertical or Horizontal) Layout Flow options are most useful in nested
situations where certain parts of the child layout need to align with the edges of the
parent layout. Figure 38 below shows the subtle difference of using a nested layout with
and without the Tight option:
The Tab Section control provides a "Tab Changed" event which gets fired anytime the
current tab is changed (either by the user or programmatically). The binding data (if the
control is bound) contains the 0-based integer index of the tab currently showing. The UI
developer can also change the current tab programmatically using the setCurrenPane()
method.
Note: A "0-based" tab index means that the first tab is at index 0, the second at index 1,
and so on.
Stack
The Stack control is similar in behavior to a Tab Section control but without any visual
decorations (no visible tabs or borders).
The Modal Section simply acts as a container. Whatever the control the UI developer
inserts in the containment box at design time is shown modally (against a darker
backdrop) at runtime, as shown in Figure 40 below containing a Well and a Progress Bar
control:
Figure 41 below shows the same Modal Section containing a Well and a Progress Bar in
IBM Process Designer’s Web Editor:
Lastly, the "On Close" event on a Modal Section control is available to take programmatic
actions when closing and fires when the Modal Section closes from user action or
programmatically (from <Modal Section control ref>.setVisible(false)).
4.5.4 Wells
Wells provide a simple way to display content in an area that can be colored and can
include an icon in its background. The purpose of Wells is mostly limited to making UIs
more visually appealing and organized (by separating parts of the UI from their
Configuration
The Service Call control is configured and works as follows:
A Service Call control must always be associated with a IBM BPM AJAX service - as
shown in the configuration example of Figure 46 below:
4
See an example of calling an AJAX service in the classic Coach Framework manner at:
http://www.ibm.com/support/knowledgecenter/SSFPJS_8.5.7/com.ibm.wbpm.wle.editor.doc/topics/tajaxse
rvice.html
Invocation sequence
Figure 48 below explains the invocation sequence needed for the Single Select control
containing shipping modes to use the Service Call control to trigger a shipping cost query
which in turn sets the retrieved cost in a Decimal control:
Sequence recap:
1. Selected item changes in the Single Select control, which triggers the On
Change event
2. The Single Select On Change handler calls execute() on the
"ShippingRateQuery" Service Call control
3. The "ShippingRateQuery" Service Call control invokes its associated
AJAX service
4. The associated AJAX service executes its server side logic and returns
the shipping cost (or an error for standard shipping mode)
5. The Service Call control's event handlers call setValue(<returned AJAX
result>) on the "Shipping Rate" Decimal control
Figure 50 Runtime example for Service Call control - AJAX service error
4.7 Responsiveness
Responsiveness in the SPARK UI Toolkit works on two levels:
Classic (IBM BPM-based) responsiveness: The basic responsive behavior exposed in
the IBM Process Designer Web Editor for controls that provide adaptive properties
Enhanced Web Component-based responsiveness: Using the SPARK responsive
capabilities that behave consistently since IBM BPM 8.5.0.1, work with both Web and
Desktop Editors of IBM Process Designer, and allow greater flexibility than Coach
form factor-based responsive triggers
At runtime, the control auto-adjusts the configuration option value of its adaptive property
based on the Coach Framework's screen factor-based trigger, as shown in the Figure 52
runtime example for the previously-configured Note control:
Using this approach (which only works with IBM BPM 8.5.5 and higher and requires using
IBM Process Designer’s Web Editor) a large number of SPARK UI controls provide
adaptive properties that can be configured, as appropriate, to provide this type of
behavior.
Coach Views with SPARK behave like "Web Components" and as such do not depend
on the overall Coach form factor (from the IBM Process Designer Web Editor) to trigger
layout changes.
Layout changes can instead be triggered by the size change of the Coach View itself,
independently from the Coach that contains it.
SPARK UI responsiveness principally relies on three controls:
Responsive Sensor
Horizontal Layout
Vertical Layout
Once box factors are specified, a Layout control (Horizontal in the previous example)
inside the Responsive Sensor can specify layout-related behavior based on one or more
of the box factors configured. In the example below, the Layout is configured with the
following options by default (settings in Appearance category):
Layout Flow: Horizontal
Horizontal Alignment: Justified
But the settings in the Responsive category override the default configuration as follows:
If Sensor1's box factor name is "Narrow":
o Layout Flow: Vertical (option labeled as "childLayout")
Note: The name of the responsive sensor to be used by the Layout control (see
Responsive > Responsive Sensor configuration option) is not a mandatory setting. If it is
not provided, the Layout control listens to its nearest Responsive Sensor parent.
The code in Example 6 (in the "On Responsive Boundary" event handler of a Responsive
Sensor control) logs the current box factor name to the web browser console when a
responsive boundary has been crossed:
—————————————————————————————————————————————————————————————————
console.log("Active box factor: " + event.boxFactor)
—————————————————————————————————————————————————————————————————
Example 6 On Responsive Boundary event handler code sample
Reminder: The On Responsive Boundary event doesn't fire every time a resize occurs. It
only fires when a new box factor becomes active.
Note: The example above assumes a Responsive Sensor contains the Layout and the
Responsive Sensor is at least configured with box factors named "Medium" and
"Narrow".
Table 7 below details the meaning of the Behaviors configuration settings for a Layout
control:
Note: For any Responsive > Behaviors setting left blank (given a particular box factor
name), then the configuration specified under the "Appearance" configuration category
applies.
This use case works equally well using the IBM Process Designer Web Editor Grid, the
layout or alignment-related adaptive properties of the SPARK Layout controls, or the
Responsive Sensor.
However, when a UI developer expects that a composite Coach View may be placed on
a Coach UI in such a way that it will not take up the entire width of the page, the
Responsive Sensor control (used inside the Coach View) is the best option to predictably
control the Coach View content's layout behavior.
Without a Responsive Sensor, when the two coach views are laid out horizontally (side
by side), the layout cannot accurately determine when to reflow. This is because, since
each Coach View in this case takes up 50% of the Coach's horizontal space, a Coach
View will be twice as narrow by the time the Coach-driven form factor takes effect - as
shown in Figure 57 below:
To configure the columns in a Table, various controls must be added to the columns of
the table (dragged & dropped from the palette) and - when needed - the individual
controls for each column can be bound to <list>.currentItem.<property> as
needed and as shown in the example from Figure 60:
Note: Tables can only be bound to lists of complex types. For lists of simple types (such
as strings, numbers, and so on) use a Layout control instead of a Table. Horizontal and
Vertical Layouts can be bound to lists of simple types and thus become repeating
containers. This is covered later in the "Layouts and repeating data" section of this
chapter.
Column configuration
By default, a table with no column configuration renders all columns containing a control
as a Coach View. Other rendering options (shown in Figure 61) are available from the
"Columns" table configuration option:
To fully configure columns in a table, a configuration entry must be explicitly added for
each column mapping to a control in the table. The first control corresponds to column
configuration entry 0, the second to entry 1, and so on.
When displaying in a table, the borders on an "input" type Coach View control such as
Text, Integer, Decimal, Date Picker, can be distracting and add unnecessary clutter. The
Seamless Coach View option renders the Coach Views but automatically removes the
border styling on input controls, as illustrated in this Figure 62 example:
Note: The Table control respects tab index on data entry. A control in the Table that is
rendered as a Coach View can be tabbed to naturally without using a mouse click or an
explicit finger tap. A currently active input control in the table shows the cursor and is
styled with a slight grey background as shown in the previous illustration.
The next illustration in Figure 64 (using the exact same example as in the previous figure)
shows how data formatting options in Simple HTML rendering can be specified to
influence the rendering of cell data:
Note: Do not omit quotes around the option keywords or they will not load properly!
For example "dateFormat": "MMM yyyy" works but dateFormat: "MMM yyyy" does not.
Table 8 below provides a summary of the supported data formatting options if Simple
HTML or Custom rendering is used for a Table column (the column containing the
appropriate associated "hint" control):
The Table > On Custom Cell event provides the "cell" context variable to the event inline
logic. The cell variable contains a number of properties and method to facilitate the
custom rendering effort. Those are detailed in Table 9 below:
Table 9 Detail of "cell" context variable in the Table > On Custom Cell event
Property or method name Description
getFormattedValue() If the purpose of the custom rendering isn't to format the data itself in a
particular way, then this method can be used to spare the developer
the effort of formatting data. This method returns the formatted value
that Simple HTML rendering would have output (including any
configured formatting options).
setSortValue() Sometimes the displayed content of a cell is not consistent with how
the data should be sorted. For example, the list of values "High",
"Medium", "Low", when lexically sorted would be ordered as "High",
"Low", "Medium". The setSortValue() method tells the table to
disregard the displayed value and use a different - developer-provided
- one instead (for example "3", "2", "1" for "High", "Medium", "Low"
respectively)
colIndex The index of the column containing the cell to be rendered. This is
especially useful when more than one column in the table is configured
to be custom-rendered
td The HTML DOM "td" element corresponding to the current cell. This
allows quick styling of the TD element itself
row.index The 0-based index of the current row containing the cell to be renderer
row.data The "record" (meaning the list item) associated with the current row
containing the cell to be rendered. If the table is bound to a list of
business objects with properties "lastName", "creditScore", for
example, those properties can be retrieved as: cell.row.data.lastName
and cell.row.data.creditScore.
varName The name of the variable associated with the current cell and column
(for example lastName)
value The value of the current variable associated with this cell. This is
exactly equivalent to using cell.row.data[cell.row.varName], but much
more convenient.
The "On Custom Cell" event also provides an additional convenience to the UI developer
through its returned result:
If the returned result in an object, a DOM element is assumed and is appended to the TD
element representing the table cell
If the returned object is a string:
o If "H" is returned the table renders the cell as if it had been configured with the
"Simple HTML" rendering option
o If "V" is returned the table renders the cell as if it had been configured with the
"Coach View" rendering option
o If "S" is returned the table renders the cell as if it had been configured with the
"Seamless Coach View" rendering option
o If any other string value is returned an error is logged to the console
Reminder: In the On Custom Cell event, either a DOM element is returned (which will
become the content of the cell) or a single character: "H", or "V", or "S".
The example in Figure 65 shows how the column displaying decimals (first column from
the left) can style its content red for value less than 400:
This next example in Figure 66 changes the custom-rendering logic of the previous
example to create an actual DOM element for the cell and includes "in-context" on-click
logic to the created links in the table:
Searching content
Rows in the Table control can be searched either by matching content in a specific
column or across all rows. The Table control itself does not provide a search text field out
of the box. Instead a simple and flexible method is provided to allow searching in different
ways.
The Table:search() method allows 4 parameters:
columnIndex (0-based integer): Only match content in a particular column. If null,
matches across all columns
The example in Figure 67 below shows a Text control used for a simple search:
Performance options
The Table control provides several features that help preserve the user experience even
with large numbers of rows and columns. Three key capabilities allow tables to display
large amounts of tabular data:
Rendering options: Displaying columns as Simple HTML (or as Custom-rendered) only
costs a small fraction of the processing otherwise needed to create and manage the
lifecycle of even the simplest of coach views
On-demand and cached rows: When paging, a table only creates rows (and associated
content and views) at the time they are displayed. This reduces the cost of creating
rows to the number of rows displayed on a page. Once a row is created it is cached
(even if it is no longer displayed because of paging, sorting, or filtering) to avoid the
overhead of recreating it
Record management: The control methods to add or remove records to the table
(appendRecord, appendRecords, removeRecord) are significantly very efficient and
do not trigger a complete table reload
Asynchronous loading: Even the lightest of tables can lock up a browser while
rendering an extremely large number of rows (because JavaScript is single-
threaded), which can be disruptive to the user experience. The SPARK UI Table
provides an asynchronous loading feature that keeps the browser fully responsive
regardless of how many rows need to be loaded. The trade-off of course is that the
rows take longer to be loaded in the background. Asynchronous loading can even be
tuned so that - for example - batches of 5 or 10 rows can load at the same time to
accelerate background loading while still preserving the user experience.
Figure 68 below highlights the performance-related features that can be used to manage
the processing overhead and the user experience when displaying a large number of
rows or columns:
Table events
Table 10 lists the events supported by the Table control:
Table 10 List and detail of events supported by the Table control
Event Description
On Custom Cell Covered in detail in the "Custom column rendering" section
On Rows Loaded This event is especially useful when asynchronous loading is on and
the developer can therefore not exactly predict when rows in the
table finish loading.
If the table uses paging, this event also fires whenever all rows on a
page finish loading. The following context variables are available:
all (boolean): true if all rows in the table are completely
loaded (if paging is on "all" is true when all pages have
been displayed)
If the logic in this event handler explicitly returns false, the record
deletion is canceled.
Additional capabilities
The Table control provides a number of methods to control selection, record insertion and
deletion, paging, sorting, and data retrieval. Check the Table control reference 5 for
additional information.
5
See https://support.salientprocess.com/docs/enterprise/Table.html
Column configuration
Unlike the Table control, the Service Data Table must be configured for each column it
needs to display. Column configuration include the mapping of the data returned by the
service and the type of rendering to use for the column, as shown in Figure 70:
If the associated AJAX service accepts a simple data type for input (such as an integer),
the setQueryData() can be invoked as shown in Example 7:
Example 7 Invoking Service Data Table:setQueryData() with simple input
Example 8 shows how to pass a complex type as input to the AJAX query:
Lastly, after setting the query data, the refresh() method must be called to invoke the
AJAX service with the new input data - as shown in Figure 72 below:
Additional capabilities
The Service Data Table control provides special capabilities in addition to the Table
control (including the ability to create and populate columns dynamically through the
setColumns method). Check the Service Data Table control reference 6 for additional
information.
6
See https://support.salientprocess.com/docs/enterprise/ServiceDataTable.html
Performance options
As with the Table control, Layouts provide asynchronous loading capabilities to display
very large lists without disrupting the user experience, through the following configuration
options in the Performance configuration category:
Note: Contained Coach Views can only rendered as "Coach Views" (no "Seamless Coach
Views", "Simple HTML", or "Custom" rendering options are currently available for a
Layout).
The (Horizontal/Vertical) Layout control also provides methods to efficiently append and
remove list elements (instead of causing the reload of the entire list), namely:
appendElement(<simple or complex object>)
removeElement(<0-based index>)
4.9 Formulas
Formulas are a simplifying and streamlining feature of the SPARK UI Toolkit. They can
significantly reduce the need for creating code to maintain computational relationships
between controls on a form.
Formulas provide support for simple expressions that prescribe how the value of a control
is the result of an operation involving other controls (for example, the ${Total} Decimal
control is the sum of the ${Sales} Decimal control and the ${TaxAmount} Decimal control.
When the value of a control can be computed through a formula, the control provides a
special option in the Formula category of its configuration options - as shown in Figure 75
containing a Decimal control's configuration example:
Once the formula is specified, the behavior of the control regarding the computation of its
value is "maintenance-free": Any updates to the values of any of the controls that are
referenced in the formula causes the expression to recalculate automatically.
When a formula references a control whose value is itself computed through a formula,
the cascade of updates occurs efficiently and in the correct order.
Note: As is usually the case for SPARK controls, data binding for controls is optional even
when using formulas. If a control computed through formula has a data binding, the
bound value is automatically updated every time the formula result changes.
Note: While the ${ } syntax is an optional convenience and can be replaced in event
handlers with the less compact page.ui.get("<control-id>") or view.ui.get("<control-id>)
alternative, it is not optional with formulas.
The ${ } notation (or the compact @{ } notation explained below) are mandatory in
formulas, otherwise the result of the formula will not be updated after its initial value.
Compact references
Because formulas are meant to be as simple to use as possible, SPARK supports a more
compact notation than the ${ } reference syntax. The following expressions (in Example
9) are fully equivalent (and resolve to the same logic at runtime), but the last is visibly
simpler to use than the first:
—————————————————————————————————————————————————————————————————
${Sales}.getValue() + ${TaxAmount}.getValue()
…is equivalent to:
@{Sales} + @{TaxAmount}
—————————————————————————————————————————————————————————————————
Example 9 Compactness comparison between ${ } and @{ } notations
The @{ } notation shortcuts the various implied control-specific methods calls (such as
getText() for a Text control, getValue() for a Decimal or Integer control, getProgress() for
a Progress Bar, and so on) and requires less programming skills to express.
That said, the formula expression becomes a JavaScript expression at runtime. This
means that the sophistication of a formula is only constrained by the facts that:
The formula must be a single JavaScript statement (but ternary operations such as
<condition> ? <statement 1> : <statement 2> are allowed)
At runtime, the formula (after references have been translated to JavaScript) is placed
inside a return( ) statement
For example, if the result of the formula "@{Sales} + @{TaxAmount}" needs to be fixed to
2 decimals, it can simply be altered as follows in Example 10:
—————————————————————————————————————————————————————————————————
(@{Sales} + @{TaxAmount}).toFixed(2)
—————————————————————————————————————————————————————————————————
Example 10 Using JavaScript in formulas
The above reference means all controls named "LineTotal" under the Table control
named "ItemsTable".
Because those functions work with aggregate references, they are referred to as
aggregate functions in the SPARK UI Toolkit.
The illustration in Figure 78 below shows the use of the SUM() function combined with
the aggregate notation for all controls named "LineTotal" under the Table named
"ItemsTable":
As is the case for all other formulas, value changes in any field directly or indirectly
referenced by the SUM() function causes the formula using the SUM() function to be
recalculated.
The runtime behavior for the above UI composition is shown in Figure 79 as follows:
For such cases, the SPARK formula framework provides support for a special notation to
work directly with the data backing the Table control instead of relying on control
references inside the table. This special notation must be used in conjunction with an
aggregate function, as shown in Example 12:
—————————————————————————————————————————————————————————————————
SUM(${ItemsTable}, FOR_EACH{#{lineTotal}})
—————————————————————————————————————————————————————————————————
Example 12 Direct data reference in a Table control
Assuming in the example above, that the ItemTable control would be bound to a list of
objects containing the following attributes:
price
…with such an approach, the total would always be correct since the formula doesn’t
depend on the existence of the controls in the table and directly uses the table's backing
data.
The FOR_EACH expression part, however, provides one more option: Since the SPARK
UI Toolkit doesn't make data binding mandatory, one might expect that a Line Total
control would have no backing data (since it is always derivable from calculation and
could therefore be considered redundant). In such a case, the UI developer needs the
sum of price x quantity calculated for each row.
Note: The content of the FOR_EACH{ } clause can be any valid JavaScript expression that
returns a result.
Tip: Use the proper syntax with data-backed expressions. Note where parentheses are
used and when curly braces are used. They are currently not interchangeable!
The Figure 81 example below shows a formula used to set the title of a Panel control to
"Hello " then the name entered in the Text control, or if no text is entered, "Hello user":
The control references in a circular reference log report are always fully qualified to help
the developer locate the source of the problem more quickly.
This section covers each key aspect of the SPARK UI reporting and analytic features.
4.10.1 Charts
SPARK UI Charts are highly configurable and interactive controls that can represent data
from a backing AJAX service or from Human Service Data. The SPARK UI Toolkit
includes seven chart controls that can be categorized in three broad classifications:
Figure 84 below provides a sampling at a glance of many of the charts types included in
the SPARK UI toolkit:
Note: The Chart AJAX service developer only needs to work with the input variable
named "input" and the "dataSeries" output variable. All other inputs and outputs are
automatically populated by the Chart control or by the Drill Down service.
In summary, to make a single data series chart work, the UI developer needs to complete
the following steps:
Place a chart on the Coach or Coach View canvas
Configure the chart to use an AJAX service (create a chart service based on the AJAX
service named "Default Chart Single Data Series Service"
Create logic in the AJAX service to populate the tw.local.dataSeries object
Figure 87 Example media consumption data represented in bar chart based on region
The above behavior is modeled with a Bar Chart SDS control, a Single Select control
containing regions (for example Europe, US), and an AJAX service backing the chart.
The bulk of the logic is in the AJAX service performing the actual query (this is usually the
case and is not really specific to using the SPARK UI toolkit).
On the client side, the Single Select "On Change" event simply needs to set the chart's
query data to the current region selected, then refresh the chart - as illustrated here in
Figure 88:
The matching successive runtime representations of the charts (for each of the 16 calls)
is shown in Figure 90 below:
Event Description
On Load Fired immediately after a chart is loaded (but it is not necessarily
populated with data at that time). Useful to take initializing steps (such
as adding a menu with static menu items for the chart - see Menus
section for more information)
On Refreshed Fired every time a chart has loaded and rendered new data from its
associated AJAX service (or when the chart loads its bound data if not
using an AJAX service).
On Click Fired when the user clicks or taps on a data point in the chart. The
data point that was selected can be retrieved through the chart's
getSelectedDataPoint() method. The On Click event is also the
best place to add context menu items - see Menus section for more
information)
On Menu Action Fired when a menu item has been clicked (see the Menus section
below for how to create context menu items). The action context
variable provides action.name to determine what menu item was
clicked.
Menus
Menus are automatically displayed on charts when:
The Behavior > Enable Menu configuration option is set on the chart
A data point (showing as a bar in a Bar Chart, a slice in the Pie Chart, and so on) is
clicked by a user
There is at least one menu item defined for the chart (through addStaticMenuAction(),
addTempMenuAction() or because the chart's drill-down behavior is active)
The example below adds two menu actions (through the addStaticMenuAction() method)
to a Bar Chart. Menu items are associated with action names, the action name is then
checked in the "On Menu Action" event to help decide what to do when a menu item is
clicked:
Sometimes it is useful to add a menu item that is only valid given the context of the click
on the chart. This next example shows how to create a temporary menu item that is only
shown when a bar labeled "Category 0" is clicked. Figure 92 below shows how the
getSelectedDataPoint() chart method is used in the On Click event to examine what the
user has clicked on (in this particular case the label of the select data point is checked):
Note: Temporary menu items are best created in the Chart's On Click event. They
disappear as soon as the menu closes. Temporary items are listed in a separate (top)
section of the context menu.
This example relies on a chart menu item click to 1) request a table query corresponding
to the selected data point label ("News" in this case) and 2) set the title of the collapsed
panel containing the table to "Details - " <data point label>.
Once the AJAX query for the table returns, the collapsed panel expands (triggered by the
table's "On Service Data Loaded" event) and the populated table is revealed.
Once the drill down behavior is enabled, charts can work as depicted in the Figure 95
Donut Chart example below:
The drill down tree is expressed as an XML document. Each node in the tree is
represented by a <drilldown> element. The <drilldown> element contains the
query associated with the node as well as any child <drilldown> element that make up
the drill-down path. The first Figure 97 example below shows the drill-down tree with the
"Type" root node only:
This next Figure 98 example adds the "Sub-type" node to the tree in the XML document:
Lastly, the Region node (child of the Sub-type node) is added in Figure 99 to complete
the drill-down tree all the way to the Region dimension:
The next Figure 100 illustration shows the drill-down tree built in Figure 99 above in
context with the behavior of the chart at runtime. The dotted lines show how each
Figure 100 Chart behavior super-imposed with drill-down tree XML document
Drill-down trees structures can be more comprehensive than the one illustrated above.
Figure 101 below shows a structure that could provide additional drill-down options,
which would then be reflected at the right drill-down level on the chart's context menu
(with multiple drill-down options when prescribed by the tree):
Figure 101 More complex drill-down tree more than one branch
Note: To create a fork in the drill-down tree, just add another <drilldown> element
as a sibling to an existing one. A parent <drilldown> element can have as many direct
<drilldown> child elements as needed. Also, note that not all branches need to have
the same length if the data analysis requirements do not necessitate it.
Lastly, the <js-query> element in a drill-down tree is not the only way to specify query
logic. SQL can be used instead of JavaScript with a <sql-query> element. The
illustration in Figure 102 below shows how the Type > Sub-Type > Region drill-down tree
might be implemented with SQL queries:
Note: The elements <js-query> and <sql-query> are mutually exclusive under a
<drilldown> element, but in the same drill-down tree, some <drilldown> elements can
contain JavaScript queries while others can contain SQL queries.
The Figure 103 illustration below shows the Drill-down AJAX service with the replaced
XML drilldown tree as per the previous instructions:
Figure 103 AJAX Drill-down tree for single data series charts
The runtime example in Figure 106 below shows how the control might behave when
using SPARK capabilities such as eventing and formula support to work with other
controls (an Output Text to display the rating in text form (for example 3/5) and a Text
Area control to request details if a rating is less than 4/5):
Note: Creating a control from scratch is a somewhat more technical activity since it
requires basic UI programing (or possibly "wrapping" a control from a library) and
connecting the control to the SPARK UI runtime).
General behavior
As is the case for most SPARK controls, basic script, Asynchronous Module Definition
(AMD) and styling dependencies are required to set up the Rating control. These include:
Scripts and CSS files:
o spark-fonts.css (from BPMExt-Style.zip)
o spark.css (from BPMExt-Style.zip)
o BPMExt-Core.js (from BPMExt-Core.zip)
AMD dependencies
o com.ibm.bpm.coach.utils/utilities (IBM utilities to control visibility)
o com.salientprocess.bpm.views/bpmext (the core SPARK API)
Additional styling is also defined to create the orange or gray star visual aspect of the
Rating control. The control's behavior configuration and variable mapping details are
provided in Figure 107 and Figure 108 below:
Figure 108 Rating Coach View's Variable tab details in IBM Process Designer
Note: The setRating and getRating() methods that are referred to in the load logic below
are defined later. They are created for convenience and merely "wrap"
context.binding.get or context.binding.set into intuitive methods for
the UI developer.
Note: The order in which SPARK control methods are called - as suggested in the above
load logic - should be followed if possible as it represents the most logical sequence for
when SPARK features for the control should be initialized at load time.
Note: To keep the Rating control example to a minimum, the Read-Only visibility status is
not implemented.
General Behavior
A Credit Card control can be placed in a Coach or Coach View. When a user completes
data entry on all the fields in the Credit Card control, an AJAX validation is triggered to
validate the CVV with the credit card number provided (as explained previously, by
checking that the credit card number starts with the same digits as those provided for the
CVV).
The Credit Card control provides an "On Validation" event which is fired whenever CVV
validation asynchronously returns a passed or failed result. In the previous example, the
containing page uses this event to display an alert for a failed result, or clear any
previous alerts for a passed result. The control also provides a clear() method which is
called when the "Reset Card Info" button is clicked. The scenario, as composed in IBM
Process Designer, is shown in Figure 116 below:
Unlike for non-composite views, it is not strictly required for a composite Coach View to
load the "bpmext" (SPARK UI) namespace through the AMD. (This is because the Coach
Framework loads SPARK child controls first and because SPARK controls already load
the SPARK API and "bpmext" in the global namespace).
However, it is still good practice to use AMD-loading including to load Coach utilities (e.g.
to control visibility). The scripts and dependencies are as follows:
Scripts and CSS files:
o BPMExt-Core.js (from BPMExt-Core.zip - optional in this case)
AMD dependencies
Note: Composite Coach Views are generally simpler to create than basic (non-composite)
views because they usually require much less "low-level" HTML DOM programming and
CSS development - often they require none at all.
Figure 117 below provides the structure of the Credit Card view in IBM Process Designer,
the variable and configuration options associated with the view and how the "colorStyle"
configuration option relates to the color of its contained Input Group controls:
Note: By convention, SPARK control methods and attributes that start with "_" are not
considered public and should not be used by developers using these controls.
The Credit Card Inline JavaScript and associated AJAX service logic is provided in Figure
120:
Note: Because the AJAX service invocation is done through the Service Call control, the
Credit Card view has no dependency on diagram logic for server interactions, which fully
encapsulates the invocation of its business logic behavior, thus making the view readily
reusable.
Because the Table and Service Data Table controls have already covered in previous
sections, only the scenarios using Deferred Sections are provided here.
Tab Section with on-demand content instantiation
The scenario in Figure 123 below shows how a Tab Section and a Deferred Section
under each tab can work together to delay the loading of Coach Views until the tab
containing them is selected:
Note: Because the Billing Info Coach View is small (contains ~10 controls) in the
particular example shown above, using a Deferred Section in a production scenario
would likely be overkill (thought it would not hurt either because a Deferred Section has
a small footprint). But the larger the view (for example 40 or 50+ contained controls), the
greater the benefit.
In the above composition, the Coach View is contained inside a Modal Section.
Because both the Modal Section and the "Contact Info" Coach View are contained under
the Deferred Section, even the instantiation overhead of Modal Section is deferred until
the user requests to load the content. In fact, it is really the Modal Section that's lazy-
loaded. The Coach Framework takes care of loading the view contained in the Modal
Section when the Modal Section instance comes into existence.
For example, with a 250-remote record data set and a page size of 100:
A query of up to 100 records at offset 0 returns the first page of 100 records
A query of up to 100 records at offset 100 returns the second page of 100 records
A query of up to 100 records at offset 200 returns the last page containing the remaining
50 records
Note 1: Server-side paging is most easily achieved with a Service Data Table control since
it is the only table control capable of fetching data through an AJAX service.
Note 2: Another more complex and less reusable pattern could be implemented through
a Table control with Human Service data fetched progressively through diagram logic and
"Stay On Page" interactions, but the pattern presented in this scenario is much simpler
and can be readily reused and encapsulated.
The example illustrated below uses a Service Data Table to query (completely artificial)
data for Media Consumption volumes. The runtime behavior for the sample server-side
paging scenario to be implemented is shown in Figure 126:
Client-side implementation
The sample scenario implementation shown here uses a Coach View which contains the
Service Data Table and the paging navigation controls ("previous" and "next" Button
controls, and an Output Text control to show the current page number).
Note: Using a Coach View to contain all the controls and associated business logic is not
at all mandatory for the server-side paging pattern, but it helps keep the implementation
self-contained and reusable.
Overall structure
The overall structure and the logic defined for the "Server Side Paging Table Example"
Coach View are given in Figure 127 below:
Note: The page size in the example provided is arbitrarily set to 5. In a more
comprehensive example, the page size could be set from a configuration option, or from
a "Page Size" Integer control in the Coach View.
By default, the Service Data Table control automatically invokes its associated AJAX
service at load time for the table. In this example however, the initial automatic query is
prevented through the "Start Empty" setting. The initial query is instead done explicitly
and with the desired initial offset (0) at load time for the "Server Side Paging Example"
Server-side implementation
The template for the AJAX service associated with the Service Data Table does not
prescribe inputs used for server-side paging. It simply allows for input one data element
of type ANY. To combine server-side paging parameters along with other query data, a
"MediaConsumptionQuery" complex type is created with the following server-side paging-
related attributes (in addition to other attributes business case-specific attributes):
offset (Integer)
maxCount (Integer)
Pattern summary
The list recaps the pattern-specific aspects of server-side paging with a Service Data
Table control:
1. Create an AJAX service associated with the Service Data Table
2. Ensure the input data for the AJAX service includes attributes for an offset and a
maximum record count
3. Implement the AJAX Service query logic to take the server-side paging parameters
into account
4. Ensure that client-side paging aspects are turned off for the Service Data Table
configuration
Note: The example provided was purposefully simplistic. Additional sophistication could
include retrieving the full record count upfront to not only display the current page, but
also the maximum number of pages available. More variability (to control the page size
and other query and sorting criteria) could easily be introduced by extending the pattern
presented in this section.
In short: Use SPARK control positioning settings (such as width, height, padding) from the
Configuration tab whenever such options are available. Otherwise use the Positioning
tab in IBM Process Designer’s Web Editor.
Since SPARK doesn't require large quantities of boundary events (and therefore
associated diagram-based scripts for each boundary event), Human Service diagrams
can become clutter-free and focus on expressing business logic at the right level.
Note: Client-side scripts can even make full use of the SPARK API to retrieve and
manipulate SPARK controls on the page that emitted the boundary event to which they
are attached.
Note 1: Configuration controls have a page-wide effect and should therefore only be
placed in Coaches, not in Coach Views.
Figure 132 Configuration control's built-in log window displayed on a mobile device
Note: SPARK log entries are only shown if the Configuration > Debugging On option is
selected.
Figure 133 Calling SPARK control methods from a web browser console
Note: Features such as code completion allow the UI developer to not have to remember
the exact method names and signatures for the SPARK API or for SPARK UI controls.
Some web browsers might not support this feature.
If using code completion, the developer should not assume that a control method or
SPARK API method is publicly available just because it is visible or accessible from the
console. Only the usage of methods published in the SPARK online documentation is
supported.
Tip: Adding "debugger" in event logic also provides a quick way to discover the context
variables available for a particular event.
Figure 135 Global text direction setting through the Configuration control
Note: The text direction can also be switched at runtime by calling the
setGlobalTextDirection() method on the Configuration control, passing in the
value "DEFAULT", "LTR" (Left-to-Right), or "RTL" (Right-to-Left).