-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-116.html
110 lines (107 loc) · 3.14 KB
/
template-116.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<h1 id="percent-bar-formatter">Percent Bar Formatter</h1>
<p>This formatter creates a percent bar.</p>
<h2 id="specific-options">Specific options</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>alignment</td>
<td>string</td>
<td>optional</td>
<td>"left"</td>
<td>Possible values are l, r, c, left, right, and center</td>
</tr>
<tr>
<td>movementColor</td>
<td>boolean</td>
<td>optional</td>
<td>true</td>
<td>If disabled, percent bar will not use up and down colors</td>
</tr>
<tr>
<td>barColor</td>
<td>string</td>
<td>optional</td>
<td>""</td>
<td>Custom color for bar element</td>
</tr>
<tr>
<td>textHidden</td>
<td>boolean</td>
<td>optional</td>
<td>false</td>
<td>If enabled, text label will not be shown</td>
</tr>
<tr>
<td>textWidth</td>
<td>number or string</td>
<td>optional</td>
<td>56</td>
<td>Number of pixel or percentage width</td>
</tr>
</tbody></table>
<h2 id="example">Example</h2>
<code-sandbox hash="38cc0f6d"><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 = ["myPercent", "word"];
var num = -100;
DataGenerator.addFieldInfo("myPercent", function(e) {
return num += 5;
});
var records = DataGenerator.generateRecords(fields, { seed: 1, numRows: 40 });
var configObj = {
sorting: {
sortableColumns: true
},
columns: [
{
name: "Percent bar (Default)",
field: fields[0],
alignment: "c",
binding: PercentBarFormatter.create()
},
{
name: "Center alignment + No Movement Color",
field: fields[0],
alignment: "c",
binding: PercentBarFormatter.create({
alignment: "c",
movementColor: false
})
},
{
name: "No Label + Custom Color",
field: fields[0],
alignment: "c",
binding: PercentBarFormatter.create({
alignment: "r",
textHidden: true,
barColor: "purple"
})
}
],
staticDataRows: records
};
var grid = document.getElementById("grid");
grid.config = configObj;
</code></pre>
</code-sandbox>