-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-122.html
63 lines (60 loc) · 3.07 KB
/
template-122.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<h1 id="text-formatter">Text Formatter</h1>
<p>This formatter creates a simple div element with text from the column's field by default. The div element can be modified in the handler (for example, <code>onElementRendered</code>) and passed through configuration object for multiple use cases. </p>
<h2 id="specific-options">Specific options</h2>
<p>The purpose of this formatter is creating a generic element for further modifications, so there are no specific options.</p>
<h2 id="example">Example</h2>
<code-sandbox hash="d7ba12ad"><pre><code class="language-css">efx-grid {
height: 320px;
}
</code></pre>
<pre><code class="language-html"><efx-grid id="grid"></efx-grid>
</code></pre>
<pre><code class="language-javascript">import { halo } from './theme-loader.js'; // This line is only required for demo purpose. It is not relevant for your application.
await halo(); // This line is only required for demo purpose. It is not relevant for your application.
/* ---------------------------------- Note ----------------------------------
DataGenerator, Formatters and extensions are exposed to global scope
in the bundle file to make it easier to create live examples.
Importing formatters and extensions is still required in your application.
Please see the document for further information.
---------------------------------------------------------------------------*/
var fields = ["number_1", "word", "float_1"];
var records = DataGenerator.generateRecords(fields, 40);
var configObj = {
columns: [
{
name: "Column 1",
field: fields[0],
alignment: "right",
binding: TextFormatter.create()
},
{
name: "Column 2",
field: fields[1],
alignment: "center",
binding: TextFormatter.create({
styles: {
"backgroundColor": "thistle"
}
})
},
{
name: "Big Text",
field: fields[2],
binding: TextFormatter.create({
styles: {
"fontSize": "1.5em"
}
})
}
],
staticDataRows: records
};
var grid = document.getElementById("grid");
grid.config = configObj;
</code></pre>
</code-sandbox><h2 id="formatting-predefined-formatter-using-text-formatting-extension">Formatting predefined formatter using Text Formatting Extension</h2>
<p>When using Text Formatting Extension, by default, predefined formatter will be overwritten due to the need for rendering a formatted text by the extension. To format the text inside predefined formatter and avoid the overriding, you will need to instruct the extension on how and where to do the formatting. See <a href="#/extensions/tr-grid-textformatting">this page</a> for more information.</p>
<p>In this case, you can use <code>onElementRendered</code> and Text Formatting Extension to do the formatting.</p>
<br>
<br>
<br>