-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-128.html
41 lines (39 loc) · 2.2 KB
/
template-128.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
<h1 id="row---reordering">Row - Reordering</h1>
<p>To allow the user to drag and reorder selected rows, add Row Dragging Extension instance to <code>extensions</code> property. The visual content of the dragged row can be rendered using the renderer function provided in the property <code>dragBoxRenderer</code> of the <code>rowDragging</code> option object. For more details, see <a href="#/extensions/tr-grid-row-dragging">Row Dragging Extension</a>.</p>
<h2 id="example">Example</h2>
<code-sandbox hash="b0fe8224"><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: 6 });
var configObj = {
rowDragging: {
dragBoxRenderer: function(e) {
e.dragBox.textContent = e.dataRow[fields[0]];
}
},
columns: [
{name: "Company", field: fields[0]},
{name: "Market", field: fields[1], width: 100},
{name: "Last", field: fields[2], width: 80},
{name: "Net. Chng", field: fields[3], width: 80},
{name: "Industry", field: fields[4]}
],
staticDataRows: records,
extensions: [ new RowDragging() ]
};
var grid = document.getElementById("grid");
grid.config = configObj;
</code></pre>
</code-sandbox>