Skip to content

Commit fc22336

Browse files
Add jQuery implementation in v24.2.5
1 parent b4ac133 commit fc22336

File tree

3 files changed

+69
-14
lines changed

3 files changed

+69
-14
lines changed

jQuery/src/index.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
.demo-container {
2-
margin: 50px;
3-
width: 90vh;
4-
}

jQuery/src/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<body class="dx-viewport">
1717
<div class="demo-container">
18-
<div id="btn"></div>
18+
<div id="gridContainer"></div>
1919
</div>
2020
</body>
21-
</html>
21+
</html>

jQuery/src/index.js

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,69 @@
1-
$(() => {
2-
let count = 0;
3-
$('#btn').dxButton({
4-
text: `Click count: ${count}`,
5-
onClick(e) {
6-
count += 1;
7-
e.component.option('text', `Click count: ${count}`);
1+
$(()=>{
2+
3+
var employees = [{
4+
"ID": 1,
5+
"FirstName": "John",
6+
"LastName": "Heart",
7+
"City": "Los Angeles"
8+
}, {
9+
"ID": 2,
10+
"FirstName": "Olivia",
11+
"LastName": "Peyton",
12+
"City": "Los Angeles"
13+
}, {
14+
"ID": 3,
15+
"FirstName": "Robert",
16+
"LastName": "Reagan",
17+
"City": "Bentonville"
18+
}, {
19+
"ID": 4,
20+
"FirstName": "Greta",
21+
"LastName": "Sims",
22+
"City": "Boise"
23+
}, {
24+
"ID": 5,
25+
"FirstName": "Brett",
26+
"LastName": "Wade",
27+
"City": "Atlanta"
28+
}];
29+
30+
$("#gridContainer").dxDataGrid({
31+
dataSource: employees,
32+
columns: ['FirstName', 'LastName', 'Title', 'City', 'Country'],
33+
paging: {
34+
pageSize: 10
835
},
36+
pager: {
37+
showPageSizeSelector: true,
38+
allowedPageSizes: [5, 10, 20]
39+
},
40+
editing: {
41+
mode: "row",
42+
allowUpdating: true,
43+
allowDeleting: true,
44+
allowAdding: true
45+
},
46+
onContextMenuPreparing: function (e) {
47+
if (e.row.rowType === "data") {
48+
e.items = [{
49+
text: "edit",
50+
onItemClick: function () {
51+
e.component.editRow(e.row.rowIndex);
52+
}
53+
},
54+
{
55+
text: "insert",
56+
onItemClick: function () {
57+
e.component.addRow();
58+
}
59+
},
60+
{
61+
text: "delete",
62+
onItemClick: function () {
63+
e.component.deleteRow(e.row.rowIndex);
64+
}
65+
}];
66+
}
67+
}
968
});
10-
});
69+
})

0 commit comments

Comments
 (0)