0 votes
471 views
in Coach Views by (2.1k points)
I have complex coachview that has child coachviews. UI taking longer than usual time to render. My requirement does not allow to use tabs or split in multiple coaches. Any ideas how can we engineer to lazy load sections . For example on selection from  drop down we display sections that has form. I like to load this form on selection only.

Thanks in advance..

1 Answer

0 votes
by (30.6k points)

When tabs and splitting are not allowed, make the child views render only when they become visible or needed. Three techniques that combine well:

1. Visibility-driven rendering - child coach views (or the sections that contain them) start Hidden (the coach framework does not build hidden views); the parent flips them to visible in stages - for example after the first paint, or when the user scrolls to them:

// parent coach view - load handler: render the heavy children one at a time after the first paint
var _this = this, heavy = ["Documents", "History", "Charts"];       // control ids of child sections/views, all with visibility Hidden
var i = 0;
function next() { if (i >= heavy.length) return; _this.ui.get(heavy[i++]).setVisible(true); setTimeout(next, 50); }
setTimeout(next, 0);
// or: render when scrolled into view (IntersectionObserver on the placeholder element of each hidden section)
heavy.forEach(function (id) {
  var v = _this.ui.get(id), ph = v.context.element;                  // the hidden view's element still exists as a placeholder
  new IntersectionObserver(function (e, obs) { if (e[0].isIntersecting) { v.setVisible(true); obs.disconnect(); } }).observe(ph);
});

2. Data on demand - a child that shows a big list gets an empty binding at load and a Service Call that runs when the section becomes visible (the visible event / the flip above), so neither the DOM nor the data is paid for up front.

3. Cheaper children - inside the children replace input controls used for display by Output Text (an Output Text is a fraction of an input control), page tables (10-15 rows), remove formulas that reference whole lists, and avoid nesting layouts five levels deep (every Horizontal / Vertical Layout is a view).

Measure with the browser's Performance profiler: the coach framework logs each view's load; the slowest 10% of views usually account for most of the time. Also see question 2527 and question 2439 for the toolkit's own lazy options.

References

Related questions

0 votes
2 answers 2.2k views
asked Dec 14, 2016 in Coach Views by venkat (2.1k points)
0 votes
1 answer 1.7k views
0 votes
1 answer 1.5k views
+1 vote
1 answer 923 views
0 votes
1 answer 1.2k views
0 votes
1 answer 1.7k views
0 votes
1 answer 651 views
0 votes
1 answer 1.1k views
0 votes
2 answers 2.9k views
0 votes
1 answer 4.0k views
0 votes
1 answer 1.5k views
0 votes
1 answer 4.1k views
+1 vote
1 answer 4.9k 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
...