-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-117.html
50 lines (48 loc) · 1.94 KB
/
template-117.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
<h1 id="simple-image-formatter">Simple Image Formatter</h1>
<p>This formatter creates an image from the column's field by default.</p>
<h2 id="example">Example</h2>
<code-sandbox hash="ea42f39e"><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 = ["image", "s_image"];
var records = new Array(40);
for(var i = 0; i < 40; ++i) {
var record = records[i] = {};
record[fields[0]] = "https://dummyimage.com/40x40&text=" + i;
record[fields[1]] = "https://dummyimage.com/15x15&text=" + i;
}
var configObj = {
sorting: {
sortableColumns: true
},
columns: [
{
name: "Image",
field: fields[0],
alignment: "c",
binding: SimpleImageFormatter.create()
},
{
name: "Small Image",
field: fields[1],
alignment: "c",
binding: SimpleImageFormatter.create()
}
],
staticDataRows: records
};
var grid = document.getElementById("grid");
grid.config = configObj;
</code></pre>
</code-sandbox>