0 votes
1.1k views
in Coach Views by (21.5k points)

1 Answer

0 votes
by (30.6k points)

The UI Toolkit table gives you multi-select with a header checkbox and column filtering with a few options, and code for the rest:

  • Select all: Selection mode = Multiple adds a checkbox column with a select all checkbox in the header on newer toolkits; on older ones add a button:
// Button "Select all" > On click
var t = ${Orders}, n = t.getData().length;
for (var i = 0; i < n; i++) t.selectIndex ? t.selectIndex(i) : t.setSelectedIndex(i, true);     // API name differs per toolkit level
// Button "Clear": t.clearSelection ? t.clearSelection() : t.setSelectedIndices([]);
// use: var chosen = t.getSelectedRecords();
  • Column filter: the table's Show filter option gives one search box over all columns; for a per-column filter, put a Text control above the table (or in a header row of a layout) and filter the bound list, keeping the full list in a hidden variable:
// Text "StatusFilter" > On change
var all = ${AllOrdersHidden}.getData() || [];                       // full list bound to a hidden Text/Data control or kept in a variable
var status = (me.getData() || "").toLowerCase(), region = (${RegionFilter}.getData() || "").toLowerCase();
${Orders}.setData(all.filter(function (o) {
  return (!status || (o.status || "").toLowerCase().indexOf(status) >= 0) && (!region || (o.region || "").toLowerCase().indexOf(region) >= 0);
}));

Notes: filtering by replacing the bound list clears the selection - store selected ids before and re-select after when needed; server-side filtering (a Service Call with the filter values) is the right approach above a few thousand rows; newer toolkit versions offer per-column filter inputs in the header (Column filtering option) - check your level's documentation before coding. Sorting is built in (sortable columns).

References

Related questions

0 votes
1 answer 1.4k views
0 votes
1 answer 871 views
+1 vote
1 answer 1.2k views
0 votes
1 answer 847 views
0 votes
1 answer 4.0k views
0 votes
1 answer 1.7k views
0 votes
1 answer 4.1k views
0 votes
1 answer 2.0k views
0 votes
1 answer 1.7k views
0 votes
1 answer 723 views
0 votes
1 answer 722 views
0 votes
1 answer 1.7k views
0 votes
1 answer 1.2k views

723 questions

807 answers

98 comments

4.9k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...