Skip to content

Commit 027ba00

Browse files
author
Dimo Dimov
committed
Fix ContextMenu API docs snippets
1 parent 306dd8e commit 027ba00

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

api/javascript/ui/contextmenu.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,14 @@ Appends an item to a **ContextMenu** in the specified referenceItem's sub menu (
598598
<div id="target">Target</div>
599599
<ul id="context-menu"></ul>
600600
<script>
601+
// initialize the ContextMenu
602+
$("#context-menu").kendoContextMenu({
603+
target: "#target"
604+
});
605+
601606
// get a reference to already initialized ContextMenu widget
602607
var contextMenu = $("#context-menu").data("kendoContextMenu");
603-
//
608+
604609
contextMenu.append(
605610
[{
606611
text: "Item 1",
@@ -667,6 +672,10 @@ Closes the **ContextMenu**. This method can be prevented to stop the closure.
667672
</li>
668673
</ul>
669674
<script>
675+
// initialize the ContextMenu
676+
$("#context-menu").kendoContextMenu({
677+
target: "#target"
678+
});
670679
// get a reference to the ContextMenu widget
671680
var contextMenu = $("#context-menu").data("kendoContextMenu");
672681
// close the ContextMenu
@@ -708,6 +717,11 @@ Prepares the **ContextMenu** for safe removal from DOM. Detaches all event handl
708717
</li>
709718
</ul>
710719
<script>
720+
// initialize the ContextMenu
721+
$("#context-menu").kendoContextMenu({
722+
target: "#target"
723+
});
724+
711725
var contextMenu = $("#context-menu").data("kendoContextMenu");
712726

713727
// detach events
@@ -739,6 +753,10 @@ initialization by setting the **disabled="disabled"** on the desired menu item h
739753
</li>
740754
</ul>
741755
<script>
756+
// initialize the ContextMenu
757+
$("#context-menu").kendoContextMenu({
758+
target: "#target"
759+
});
742760
// get a reference to the ContextMenu widget
743761
var contextMenu = $("#context-menu").data("kendoContextMenu");
744762
// disable the li menu item with the id "secondItem"
@@ -783,6 +801,10 @@ Inserts an item into a **ContextMenu** after the specified referenceItem.
783801
</li>
784802
</ul>
785803
<script>
804+
// initialize the ContextMenu
805+
$("#context-menu").kendoContextMenu({
806+
target: "#target"
807+
});
786808
// get a reference to the ContextMenu widget
787809
var contextMenu = $("#context-menu").data("kendoContextMenu");
788810
//
@@ -852,6 +874,10 @@ Inserts an item into a **ContextMenu** before the specified referenceItem.
852874
</li>
853875
</ul>
854876
<script>
877+
// initialize the ContextMenu
878+
$("#context-menu").kendoContextMenu({
879+
target: "#target"
880+
});
855881
// get a reference to the ContextMenu widget
856882
var contextMenu = $("#context-menu").data("kendoContextMenu");
857883
//
@@ -921,6 +947,10 @@ Shows the **ContextMenu** at the specified coordinates in pixels or aligned to t
921947
</li>
922948
</ul>
923949
<script>
950+
// initialize the ContextMenu
951+
$("#context-menu").kendoContextMenu({
952+
target: "#target"
953+
});
924954
// get a reference to the ContextMenu widget
925955
var contextMenu = $("#context-menu").data("kendoContextMenu");
926956
// open the ContextMenu at 100px, 100px
@@ -965,6 +995,10 @@ Removes a specified item(s) from a **ContextMenu**.
965995
</li>
966996
</ul>
967997
<script>
998+
// initialize the ContextMenu
999+
$("#context-menu").kendoContextMenu({
1000+
target: "#target"
1001+
});
9681002
// get a reference to the ContextMenu widget
9691003
var contextMenu = $("#context-menu").data("kendoContextMenu");
9701004
// remove the item with the id "Item1"
@@ -1053,6 +1087,10 @@ The jQuery event that triggered this one - only available for the close event of
10531087
</li>
10541088
</ul>
10551089
<script>
1090+
// initialize the ContextMenu
1091+
$("#context-menu").kendoContextMenu({
1092+
target: "#target"
1093+
});
10561094
// get a reference to the ContextMenu widget
10571095
var contextMenu = $("#context-menu").data("kendoContextMenu");
10581096
// bind to the close event
@@ -1131,6 +1169,10 @@ The jQuery event that triggered this one - only available for the open event of
11311169
</li>
11321170
</ul>
11331171
<script>
1172+
// initialize the ContextMenu
1173+
$("#context-menu").kendoContextMenu({
1174+
target: "#target"
1175+
});
11341176
// get a reference to the ContextMenu widget
11351177
var contextMenu = $("#context-menu").data("kendoContextMenu");
11361178
// bind to the open event
@@ -1205,6 +1247,10 @@ The current target of the ContextMenu - either the init target or the current el
12051247
</li>
12061248
</ul>
12071249
<script>
1250+
// initialize the ContextMenu
1251+
$("#context-menu").kendoContextMenu({
1252+
target: "#target"
1253+
});
12081254
// get a reference to the ContextMenu widget
12091255
var contextMenu = $("#context-menu").data("kendoContextMenu");
12101256
// bind to the activate event
@@ -1279,6 +1325,10 @@ The current target of the ContextMenu - either the init target or the current el
12791325
</li>
12801326
</ul>
12811327
<script>
1328+
// initialize the ContextMenu
1329+
$("#context-menu").kendoContextMenu({
1330+
target: "#target"
1331+
});
12821332
// get a reference to the ContextMenu widget
12831333
var contextMenu = $("#context-menu").data("kendoContextMenu");
12841334
// bind to the deactivate event
@@ -1353,11 +1403,14 @@ The current target of the ContextMenu - either the init target or the current el
13531403
</li>
13541404
</ul>
13551405
<script>
1406+
// initialize the ContextMenu
1407+
$("#context-menu").kendoContextMenu({
1408+
target: "#target"
1409+
});
13561410
// get a reference to the ContextMenu widget
13571411
var contextMenu = $("#context-menu").data("kendoContextMenu");
13581412
// bind to the select event
13591413
contextMenu.bind("select", function(e) {
13601414
// handle event
13611415
});
13621416
</script>
1363-

0 commit comments

Comments
 (0)