You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Aurelia currently supports two different ways of view compilation: enhance and the view-compiler. The rule of thumb is to use enhance when you have an existing element (such as the <tr>), and when you have a template (but no elements yet) to use the view-compiler.
We are currently using enhance when kendo calls the angular function here, but since compilation is done on a row-to-row basis, performance is pretty bad when virtualization is enabled and a pagesize of 100 is used. So we would like to do compilation of the Grid cells by using the view-compiler.
There are 4 terms you must know to understand the process: ViewCompiler, ViewFactory, View and ViewSlot.
The ViewCompiler accepts a template and returns a ViewFactory.
The ViewFactory allows you to create Views from an already compiled template.
A View is an instantation of a template
The ViewSlot represents a slot or location within the DOM to which views can be added and removed. This ViewSlot has to be added to the DOM, which is done by passing in an element when creating a ViewSlot.
In pseudo-code, it looks like this:
// the ViewFactory compiles the template once
// and Views should be created for every cell
let viewFactory = viewCompiler.compile('<span>${bindingExpression}</span>');
// this is the iterating part
let view = viewFactory.create();
// parentElement is the place where we want to insert the ViewSlot
let viewSlot = new ViewSlot(parentElement, false);
// add the View to the ViewSlot
viewSlot.add(view);
// initialize binding, by passing the dataItem of the cell as the context
viewSlot.bind(dataItem);
viewSlot.attached();
We got the creation of the ViewFactory covered, as we're passing the column template to Kendo's Grid ourselves. However, we need a hook where we have the column that's being rendered, the dataItem of the cell, and the location where we can insert our compiled element in the DOM.
The text was updated successfully, but these errors were encountered:
Currently being written
Aurelia currently supports two different ways of view compilation:
enhance
and theview-compiler
. The rule of thumb is to useenhance
when you have an existing element (such as the<tr>
), and when you have a template (but no elements yet) to use theview-compiler
.We are currently using
enhance
when kendo calls theangular
function here, but since compilation is done on a row-to-row basis, performance is pretty bad when virtualization is enabled and a pagesize of100
is used. So we would like to do compilation of the Grid cells by using theview-compiler
.There are 4 terms you must know to understand the process:
ViewCompiler
,ViewFactory
,View
andViewSlot
.ViewCompiler
accepts atemplate
and returns aViewFactory
.ViewFactory
allows you to createViews
from an already compiled template.View
is an instantation of atemplate
ViewSlot
represents a slot or location within the DOM to which views can be added and removed. ThisViewSlot
has to be added to the DOM, which is done by passing in an element when creating aViewSlot
.In pseudo-code, it looks like this:
We got the creation of the ViewFactory covered, as we're passing the column template to Kendo's Grid ourselves. However, we need a hook where we have the column that's being rendered, the
dataItem
of the cell, and the location where we can insert our compiled element in the DOM.The text was updated successfully, but these errors were encountered: