-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-110.html
90 lines (87 loc) · 3.11 KB
/
template-110.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<h1 id="ef-icon-formatter">EF Icon Formatter</h1>
<p>This formatter creates a <a href="https://ui.refinitiv.com/elements/icon">ef-icon</a> from the column's field by default.</p>
<blockquote>
<p>A full list of available icons can be found <a href="https://ui.refinitiv.com/elements/icon">here</a>. </p>
</blockquote>
<h2 id="specific-options">Specific options</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>icon</td>
<td>string or object</td>
<td>optional</td>
<td>Icon shown in the cell</td>
</tr>
<tr>
<td>size</td>
<td>string or number</td>
<td>optional</td>
<td>Size of an icon in pixels</td>
</tr>
</tbody></table>
<h2 id="example">Example</h2>
<code-sandbox hash="c18996b8"><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 icons = ["3d-surface", "api", "eye", "conference", "flame"];
DataGenerator.addFieldInfo("number", { type: "number", min: 0, max: 5 });
DataGenerator.addFieldInfo("icon", { type: "set", members: icons });
var fields = ["number", "icon"];
var records = DataGenerator.generateRecords(fields, { seed: 1, numRows: 20 });
var configObj = {
columns: [
{
name: "Static Icon",
alignment: "c",
binding: EFIconFormatter.create({
icon: "3d-surface",
})
},
{
name: "Dynamic Icon With Mapper",
field: fields[0],
sort: fields[0],
alignment: "c",
binding: EFIconFormatter.create({
icon: {
0: "up",
1: "down",
2: "left",
3: "right",
4: "line"
},
size: 20
})
},
{
name: "Dynamic Icon",
field: fields[1],
sort: fields[1],
alignment: "c",
binding: EFIconFormatter.create()
}
],
staticDataRows: records
};
var grid = document.getElementById("grid");
grid.config = configObj;
</code></pre>
</code-sandbox>