Skip to content

Commit 8aef6e1

Browse files
update code snippets
1 parent 7e40f5c commit 8aef6e1

File tree

5 files changed

+86
-71
lines changed

5 files changed

+86
-71
lines changed

angular/src/app/app.component.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<dx-drop-down-button
2-
text="Sandra Johnson"
3-
icon="user"
4-
[items]="actions"
5-
keyExpr="id"
6-
displayExpr="text"
7-
(onItemClick)="logAction($event)"
8-
[splitButton]="true"
9-
(onButtonClick)="logButtonClick()">
10-
</dx-drop-down-button>
2+
text="Sandra Johnson"
3+
icon="user"
4+
[items]="actions"
5+
keyExpr="id"
6+
displayExpr="text"
7+
(onItemClick)="logAction($event)"
8+
[splitButton]="true"
9+
(onButtonClick)="logButtonClick()"
10+
[dropDownOptions]="dropDownOptions"
11+
>
12+
</dx-drop-down-button>

angular/src/app/app.component.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
import { Component } from '@angular/core';
22

33
@Component({
4-
selector: 'app-root',
5-
templateUrl: './app.component.html',
6-
styleUrls: ['./app.component.css']
4+
selector: 'app-root',
5+
templateUrl: './app.component.html',
6+
styleUrls: ['./app.component.css'],
77
})
88
export class AppComponent {
9-
actions: Array<{id: Number, text: String, icon: String}> = [
10-
    { id: 1, text: "My profile", icon: "user" },
11-
    { id: 2, text: "Messages", icon: "email" },
12-
    { id: 3, text: "Contacts", icon: "group" },
13-
    { id: 4, text: "Log out", icon: "runner" }
14-
];
9+
actions: Array<{ id: Number; text: String; icon: String }> = [
10+
{ id: 1, text: 'My profile', icon: 'user' },
11+
{ id: 2, text: 'Messages', icon: 'email' },
12+
{ id: 3, text: 'Contacts', icon: 'group' },
13+
{ id: 4, text: 'Log out', icon: 'runner' },
14+
];
15+
dropDownOptions = {
16+
height: 150,
17+
};
1518

16-
logAction(e) {
17-
console.log(e.itemData.text + " was clicked");
18-
}
19+
logAction(e) {
20+
console.log(e.itemData.text + ' was clicked');
21+
}
1922

20-
logButtonClick() {
21-
console.log("Main button was clicked");
22-
}
23+
logButtonClick() {
24+
console.log('Main button was clicked');
25+
}
2326
}

jquery/index.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
const actions = [
2-
    { id: 1, text: "My profile", icon: "user" },
3-
    { id: 2, text: "Messages", icon: "email" },
4-
    { id: 3, text: "Contacts", icon: "group" },
5-
    { id: 4, text: "Log out", icon: "runner" }
2+
{ id: 1, text: 'My profile', icon: 'user' },
3+
{ id: 2, text: 'Messages', icon: 'email' },
4+
{ id: 3, text: 'Contacts', icon: 'group' },
5+
{ id: 4, text: 'Log out', icon: 'runner' },
66
];
77

8-
$(function() {
9-
$("#myDropDownButton").dxDropDownButton({
10-
text: "Sandra Johnson",
11-
icon: "user",
12-
displayExpr: "text",
13-
items: actions,
14-
keyExpr: "id",
15-
onItemClick: function(e) {
16-
console.log(e.itemData.text + " was clicked");
17-
},
18-
splitButton: true,
19-
onButtonClick: function() {
20-
console.log("Main button was clicked");
21-
}
22-
});
23-
});
8+
$(function () {
9+
$('#myDropDownButton').dxDropDownButton({
10+
text: 'Sandra Johnson',
11+
icon: 'user',
12+
displayExpr: 'text',
13+
items: actions,
14+
keyExpr: 'id',
15+
onItemClick: function (e) {
16+
console.log(e.itemData.text + ' was clicked');
17+
},
18+
splitButton: true,
19+
onButtonClick: function () {
20+
console.log('Main button was clicked');
21+
},
22+
dropDownOptions: {
23+
height: 150,
24+
},
25+
});
26+
});

react/src/App.js

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,37 @@ import 'devextreme/dist/css/dx.light.css';
66
import DropDownButton from 'devextreme-react/drop-down-button';
77

88
const actions = [
9-
{ id: 1, text: "My profile", icon: "user" },
10-
{ id: 2, text: "Messages", icon: "email" },
11-
{ id: 3, text: "Contacts", icon: "group" },
12-
{ id: 4, text: "Log out", icon: "runner" }
9+
{ id: 1, text: 'My profile', icon: 'user' },
10+
{ id: 2, text: 'Messages', icon: 'email' },
11+
{ id: 3, text: 'Contacts', icon: 'group' },
12+
{ id: 4, text: 'Log out', icon: 'runner' },
1313
];
14-
14+
const dropDownOptions = {
15+
height: 150,
16+
};
1517
class App extends React.Component {
16-
logAction(e) {
17-
console.log(e.itemData.text + " was clicked");
18-
}
18+
logAction(e) {
19+
console.log(e.itemData.text + ' was clicked');
20+
}
1921

20-
logButtonClick() {
21-
console.log("Main button was clicked");
22-
}
22+
logButtonClick() {
23+
console.log('Main button was clicked');
24+
}
2325

24-
render() {
25-
return (
26-
<DropDownButton
27-
text="Sandra Johnson"
28-
icon="user"
29-
items={actions}
30-
keyExpr="id"
31-
displayExpr="text"
32-
onItemClick={this.logAction}
33-
splitButton={true}
34-
onButtonClick={this.logButtonClick}
35-
/>
36-
);
37-
}
26+
render() {
27+
return (
28+
<DropDownButton
29+
text="Sandra Johnson"
30+
icon="user"
31+
items={actions}
32+
keyExpr="id"
33+
displayExpr="text"
34+
onItemClick={this.logAction}
35+
splitButton={true}
36+
onButtonClick={this.logButtonClick}
37+
dropDownOptions={dropDownOptions}
38+
/>
39+
);
40+
}
3841
}
39-
export default App;
42+
export default App;

vue/src/App.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@item-click="logAction"
99
:split-button="true"
1010
@button-click="logButtonClick"
11+
:drop-down-options="dropDownOptions"
1112
/>
1213
</template>
1314

@@ -27,7 +28,10 @@ export default {
2728
},
2829
data() {
2930
return {
30-
actions
31+
actions,
32+
dropDownOptions: {
33+
height: 150,
34+
}
3135
}
3236
},
3337
methods: {

0 commit comments

Comments
 (0)