Skip to content

Commit c83cafd

Browse files
Merge pull request #1 from czernous-devexpress/add_dropDownOptions_DDB
update code snippets
2 parents 31a1071 + 341febb commit c83cafd

File tree

5 files changed

+56
-42
lines changed

5 files changed

+56
-42
lines changed

angular/src/app/app.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
displayExpr="text"
77
(onItemClick)="logAction($event)"
88
[splitButton]="true"
9-
(onButtonClick)="logButtonClick()">
10-
</dx-drop-down-button>
9+
(onButtonClick)="logButtonClick()"
10+
[dropDownOptions]="dropDownOptions">
11+
</dx-drop-down-button>

angular/src/app/app.component.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@ import { Component } from '@angular/core';
66
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" }
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' }
1414
];
15+
dropDownOptions = {
16+
height: 150
17+
};
1518

1619
logAction(e) {
17-
console.log(e.itemData.text + " was clicked");
20+
console.log(e.itemData.text + ' was clicked');
1821
}
1922

2023
logButtonClick() {
21-
console.log("Main button was clicked");
24+
console.log('Main button was clicked');
2225
}
2326
}

jquery/index.js

Lines changed: 18 additions & 15 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",
8+
$(function () {
9+
$('#myDropDownButton').dxDropDownButton({
10+
text: 'Sandra Johnson',
11+
icon: 'user',
12+
displayExpr: 'text',
1313
items: actions,
14-
keyExpr: "id",
15-
onItemClick: function(e) {
16-
console.log(e.itemData.text + " was clicked");
14+
keyExpr: 'id',
15+
onItemClick: function (e) {
16+
console.log(e.itemData.text + ' was clicked');
1717
},
1818
splitButton: true,
19-
onButtonClick: function() {
20-
console.log("Main button was clicked");
19+
onButtonClick: function () {
20+
console.log('Main button was clicked');
21+
},
22+
dropDownOptions: {
23+
height: 150
2124
}
2225
});
23-
});
26+
});

react/src/App.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ 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 {
1618
logAction(e) {
17-
console.log(e.itemData.text + " was clicked");
19+
console.log(e.itemData.text + ' was clicked');
1820
}
1921

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

2426
render() {
@@ -32,8 +34,9 @@ class App extends React.Component {
3234
onItemClick={this.logAction}
3335
splitButton={true}
3436
onButtonClick={this.logButtonClick}
37+
dropDownOptions={dropDownOptions}
3538
/>
3639
);
3740
}
3841
}
39-
export default App;
42+
export default App;

vue/src/App.vue

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
@item-click="logAction"
99
:split-button="true"
1010
@button-click="logButtonClick"
11+
:drop-down-options="dropDownOptions"
1112
/>
1213
</template>
1314

1415
<script>
1516
import DxDropDownButton from 'devextreme-vue/drop-down-button';
1617
1718
const actions = [
18-
{ id: 1, text: "My profile", icon: "user" },
19-
{ id: 2, text: "Messages", icon: "email" },
20-
{ id: 3, text: "Contacts", icon: "group" },
21-
{ id: 4, text: "Log out", icon: "runner" }
19+
{ id: 1, text: 'My profile', icon: 'user' },
20+
{ id: 2, text: 'Messages', icon: 'email' },
21+
{ id: 3, text: 'Contacts', icon: 'group' },
22+
{ id: 4, text: 'Log out', icon: 'runner' }
2223
];
2324
2425
export default {
@@ -27,16 +28,19 @@ export default {
2728
},
2829
data() {
2930
return {
30-
actions
31-
}
31+
actions,
32+
dropDownOptions: {
33+
height: 150
34+
}
35+
};
3236
},
3337
methods: {
3438
logAction(e) {
35-
console.log(e.itemData.text + " was clicked");
39+
console.log(e.itemData.text + ' was clicked');
3640
},
3741
logButtonClick() {
38-
console.log("Main button was clicked");
42+
console.log('Main button was clicked');
3943
}
4044
}
41-
}
42-
</script>
45+
};
46+
</script>

0 commit comments

Comments
 (0)