-
Notifications
You must be signed in to change notification settings - Fork 1
/
Index.cshtml
34 lines (30 loc) · 1010 Bytes
/
Index.cshtml
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
@using GettingStartedWithButtonGroup.Models
@{
ViewBag.Title = "Index";
}
<h2>Home</h2>
@(Html.DevExtreme().ButtonGroup()
.KeyExpr("style")
.SelectionMode(ButtonGroupSelectionMode.Multiple)
.Items(items =>
{
items.Add().Icon("bold").Option("style", "bold");
items.Add().Icon("italic").Option("style", "italic");
items.Add().Icon("underline").Option("style", "underline");
items.Add().Icon("strike").Option("style", "strike");
})
.SelectedItemKeys(new string[] { "italic" })
.OnSelectionChanged("logSelectionChanged")
)
<script type="text/javascript">
function logSelectionChanged (e) {
const selectedItemKeys = e.component.option("selectedItemKeys");
let message;
if(selectedItemKeys.length > 0) {
message = "The following styles are selected: " + selectedItemKeys.join(", ");
} else {
message = "There are no selected styles"
}
console.log(message);
}
</script>