-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-142.html
60 lines (58 loc) · 2.52 KB
/
template-142.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
<h1 id="default-sort">Default Sort</h1>
<p>You can sort data in the grid automatically after initialization by specifying the <code>initialSort</code> option, which receives the following two options: <code>colIndex</code> and <code>sortOrder</code>.</p>
<p>The possible values of <code>sortOrder</code> are:</p>
<ul>
<li><em>a</em> for Ascending</li>
<li><em>d</em> for Descending</li>
<li><em>n</em> for Neutral</li>
</ul>
<p>You can see all possible values for the sort order <a href="#/apis/core/sortabletitleplugin#~SortOrder">here</a>.</p>
<pre><code class="language-js">var config = {
// any other grid's options
sorting: {
sortableColumns: true,
initialSort: {
colIndex: 0,
sortOrder: "d"
}
}
}
</code></pre>
<h2 id="example">Example</h2>
<code-sandbox hash="6f4d02b1"><pre><code class="language-css">efx-grid {
height: 200px;
}
</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 = ["companyName", "market", "CF_LAST", "CF_NETCHNG", "industry"];
var records = DataGenerator.generateRecords(fields, { numRows: 10 });
var configObj = {
sorting: {
sortableColumns: true,
initialSort: {
colIndex: 0, // Column index
sortOrder: "d"
}
},
columns: [
{name: "Company", field: fields[0]},
{name: "Market", field: fields[1], width: 120},
{name: "Last", field: fields[2], width: 100},
{name: "Net. Chng", field: fields[3], width: 100},
{name: "Industry", field: fields[4]}
],
staticDataRows: records
};
var grid = document.getElementById("grid");
grid.config = configObj;
</code></pre>
</code-sandbox>