Skip to content

Commit e086b26

Browse files
committed
Sync with Kendo UI Professional
1 parent 668b5f8 commit e086b26

File tree

14 files changed

+319
-436
lines changed

14 files changed

+319
-436
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "year": 2024, "release": 2, "smallRelease": true }
1+
{ "year": 2024, "release": 3, "smallRelease": false }
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: Toggle Edit Mode
3+
page_title: Toggle Edit Mode
4+
description: "Learn how to toggle the edit mode of the Telerik UI for {{ site.framework }} Grid."
5+
position: 7
6+
slug: toggle_edit_mode_grid
7+
---
8+
9+
10+
# Toggle Edit Mode
11+
12+
As of the R3 2024 release, the {{ site.product }} Grid enables you to toggle its editable state. The feature provides the ability to switch the Grid between Readonly and Editable mode. The Grid can be initialized in either of the states and they can be toggled on the client-side, depending on the application logic.
13+
14+
For a runnable example, refer to the [Grid Toggle Edit Mode demo](https://demos.telerik.com/{{ site.platform }}/grid/toggle-edit-mode).
15+
16+
## Setting the Readonly Mode
17+
18+
To enable the Readonly mode, use the `Editable.Readonly()` configuration method.
19+
20+
```HtmlHelper
21+
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
22+
.Name("grid")
23+
.Columns(columns =>
24+
{
25+
columns.Bound(p => p.ProductName);
26+
columns.Bound(p => p.UnitPrice).Width(140);
27+
columns.Bound(p => p.UnitsInStock).Width(140);
28+
columns.Bound(p => p.Discontinued).Width(100);
29+
columns.Command(command =>
30+
{
31+
command.Edit();
32+
command.Destroy();
33+
}).Width(150);
34+
})
35+
.ToolBar(toolbar =>
36+
{
37+
toolbar.Create();
38+
})
39+
.Editable(editable => editable
40+
.Mode(GridEditMode.InLine)
41+
.Readonly(true)
42+
)
43+
.DataSource(dataSource => dataSource
44+
.Ajax()
45+
.PageSize(20)
46+
.ServerOperation(false)
47+
.Model(model => model.Id(p => p.ProductID))
48+
.Create("Editing_Create", "Grid")
49+
.Read("Editing_Read", "Grid")
50+
.Update("Editing_Update", "Grid")
51+
.Destroy("Editing_Destroy", "Grid")
52+
)
53+
)
54+
```
55+
{% if site.core %}
56+
```TagHelper
57+
<kendo-grid name="Grid">
58+
<datasource type="DataSourceTagHelperType.Ajax" page-size="20"
59+
server-operation="false">
60+
<schema data="Data" total="Total">
61+
<model id="ProductID">
62+
<fields>
63+
<field name="ProductID" type="number" editable="false"></field>
64+
<field name="ProductName" type="string"></field>
65+
<field name="UnitPrice" type="number"></field>
66+
<field name="UnitsInStock" type="number"></field>
67+
<field name="Discontinued" type="boolean"></field>
68+
</fields>
69+
</model>
70+
</schema>
71+
<transport>
72+
<read url="@Url.Action("Editing_Read", "Grid")" />
73+
<update url="@Url.Action("Editing_Update", "Grid")" />
74+
<create url="@Url.Action("Editing_Create", "Grid")" />
75+
<destroy url="@Url.Action("Editing_Destroy", "Grid")" />
76+
</transport>
77+
</datasource>
78+
<columns>
79+
<column field="ProductName" />
80+
<column field="UnitPrice" width="140" />
81+
<column field="UnitsInStock" width="140" />
82+
<column field="Discontinued" width="100" />
83+
<column width="150">
84+
<commands>
85+
<column-command text="Edit" name="edit"></column-command>
86+
<column-command text="Delete" name="destroy"></column-command>
87+
</commands>
88+
</column>
89+
</columns>
90+
<toolbar>
91+
<toolbar-button name="create"></toolbar-button>
92+
</toolbar>
93+
<editable mode="inline" readonly="true" />
94+
</kendo-grid>
95+
```
96+
{% endif %}
97+
98+
## Toggling the Edit Mode
99+
100+
The {{ site.product }} Grid allows you to programmatically alter the editable state of the component through the following methods:
101+
102+
* [`disableEditing()`](/api/javascript/ui/grid/methods/disableediting)&mdash;Disables editing operations.
103+
* [`enableEditing()`](/api/javascript/ui/grid/methods/enableediting)&mdash;Enables editing operations.
104+
105+
106+
```JavaScript
107+
$(document).ready(function(){
108+
// Determine whether either of the methods should be invoked.
109+
$("#grid").getKendoGrid().disableEditing();
110+
$("#grid").getKendoGrid().enableEditing();
111+
})
112+
```
113+
114+
## See Also
115+
116+
* [Toggle Edit Mode of the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/toggle-edit-mode)
117+
* [Server-Side API](/api/grid)
118+
* [Client-Side API](https://docs.telerik.com/kendo-ui/api/javascript/ui/grid)

docs/api/javascript/kendo.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,29 +1209,6 @@ Returns `true` if the browser supports input placeholders.
12091209
##### zoomLevel `Number` *(default: 1)*
12101210
Returns the current zoom level on a mobile browser (returns 1 on desktop).
12111211

1212-
### support.transforms `Object`
1213-
Returns a number of browser specific transformation properties
1214-
1215-
#### support.transforms
1216-
##### transforms.css `String`
1217-
Returns the CSS prefix of the current browser proprietary transform properties. E.g. "-webkit-", "-moz-", "-o-", "-ms-"
1218-
1219-
##### transforms.prefix `String`
1220-
Returns the JavaScript prefix of the current browser proprietary transform properties. E.g. "webkit", "Moz", "O", "ms"
1221-
1222-
### support.transitions `Object`
1223-
Returns a number of browser specific transition properties
1224-
1225-
#### support.transitions
1226-
##### transitions.css `String`
1227-
Returns the CSS prefix of the current browser proprietary transition properties. E.g. "-webkit-", "-moz-", "-o-", "-ms-"
1228-
1229-
##### transitions.prefix `String`
1230-
Returns the JavaScript prefix of the current browser proprietary transition properties. E.g. "webkit", "Moz", "O", "ms"
1231-
1232-
##### transitions.event `String`
1233-
Returns the transition end event name in the current browser. E.g. "webkitTransitionEnd", "transitionend", "oTransitionEnd"
1234-
12351212
### support.mobileOS `Object`
12361213
Returns a number of properties that identify the current mobile browser. Parses navigator.userAgent to do it. False on desktop.
12371214

docs/controls/pivotgridv2/binding/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ For more information on binding the PivotGridV2 to data over an OLAP cube, refer
2525

2626
The local data binding allows the PivotGridV2 to read data from a JavaScript array.
2727

28-
For more information on binding the PivotGridV2 to local data, refer to the [Local Binding]({$ slug localbinding_kendoui_pivotgridv2 %}) article.
28+
For more information on binding the PivotGridV2 to local data, refer to the [Local Binding](https://docs.telerik.com/kendo-ui/controls/pivotgridv2/binding/local-binding) article.
2929

3030
## See Also
3131

docs/knowledge-base/shorten-chart-labels.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ The following example demonstrates how to shorten long Chart labels and turn the
7373
value = value.substring(0, 10);
7474
return value + "...";
7575
}
76+
77+
return value;
7678
}
7779
</script>
7880
```

docs/knowledge-base/treeview-contextmenu-edit-node-text.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ How can I edit the text of a TreeView node by using a context menu?
5959
6060
$("#menu").kendoContextMenu({
6161
target: "#treeview",
62-
filter: ".k-in",
62+
filter: ".k-treeview-leaf",
6363
select: function (e) {
64-
var node = $("#treeview").getKendoTreeView().dataItem($(e.target).closest(".k-item"));
64+
var node = $("#treeview").getKendoTreeView().dataItem($(e.target).closest(".k-treeview-item"));
6565
// create and open Window
6666
$("<div />")
6767
.html(editTemplate({ node: node }))
@@ -79,7 +79,6 @@ How can I edit the text of a TreeView node by using a context menu?
7979
8080
var dialog = $(e.currentTarget).closest("[data-role=window]").getKendoWindow();
8181
var textbox = dialog.element.find(".k-textbox");
82-
debugger;
8382
node.set("text", textbox.val());
8483
8584
dialog.close();

docs/styles-and-layout/sass-themes/font-icons.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ To set the icon color, use the `color` CSS property.
121121
To accommodate an icon in your application, flip it by using the `k-flip-h` and `k-flip-v` predefined CSS classes.
122122
123123
```dojo
124+
<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-font-icons/dist/index.css"/>
124125
<span class="k-icon k-font-icon k-i-pencil"></span>
125126
<span class="k-icon k-font-icon k-i-pencil k-flip-h"></span>
126127
<span class="k-icon k-font-icon k-i-pencil k-flip-v"></span>

src/kendo.calendar.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ let __meta__ = {
2525
extractFormat = kendo._extractFormat,
2626
template = kendo.template,
2727
getCulture = kendo.getCulture,
28-
transitions = kendo.support.transitions,
29-
transitionOrigin = transitions ? transitions.css + "transform-origin" : "",
28+
transitionOrigin = "transform-origin",
3029
cellTemplate = template((data) => `<td class="${data.cssClass}" role="gridcell"><span tabindex="-1" class="k-link" data-href="#" data-${data.ns}value="${data.dateString}">${data.value}</span></td>`),
3130
emptyCellTemplate = template(() => '<td role="gridcell" class="k-calendar-td k-empty"></td>'),
3231
otherMonthCellTemplate = template(() => '<td role="gridcell" class="k-calendar-td k-empty">&nbsp;</td>'),

src/kendo.core.js

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ function pad(number, digits, end) {
18521852
})();
18531853

18541854
function getShadows(element) {
1855-
var shadow = element.css(kendo.support.transitions.css + "box-shadow") || element.css("box-shadow"),
1855+
var shadow = element.css("box-shadow"),
18561856
radius = shadow ? shadow.match(boxShadowRegExp) || [ 0, 0, 0, 0, 0 ] : [ 0, 0, 0, 0, 0 ],
18571857
blur = math.max((+radius[3]), +(radius[4] || 0));
18581858

@@ -2192,41 +2192,16 @@ function pad(number, digits, end) {
21922192

21932193
support.touch = "ontouchstart" in window;
21942194

2195-
var docStyle = document.documentElement.style;
2196-
var transitions = support.transitions = false,
2197-
transforms = support.transforms = false,
2198-
elementProto = "HTMLElement" in window ? HTMLElement.prototype : [];
2195+
let docStyle = document.documentElement.style;
2196+
let elementProto = "HTMLElement" in window ? HTMLElement.prototype : [];
21992197

2198+
// Transforms and Transitions - no longer required, however these were public properties in the past.
2199+
// It is possible some customers may have used them so keep them for the time being.
2200+
support.transforms = support.transitions = { css: "", prefix: "", event: "transitionend" };
22002201
support.hasHW3D = ("WebKitCSSMatrix" in window && "m11" in new window.WebKitCSSMatrix()) || "MozPerspective" in docStyle || "msPerspective" in docStyle;
22012202
support.cssFlexbox = ("flexWrap" in docStyle) || ("WebkitFlexWrap" in docStyle) || ("msFlexWrap" in docStyle);
22022203

2203-
each([ "Moz", "webkit", "O", "ms" ], function() {
2204-
var prefix = this.toString(),
2205-
hasTransitions = typeof table.style[prefix + "Transition"] === STRING;
2206-
2207-
if (hasTransitions || typeof table.style[prefix + "Transform"] === STRING) {
2208-
var lowPrefix = prefix.toLowerCase();
2209-
2210-
transforms = {
2211-
css: (lowPrefix != "ms") ? "-" + lowPrefix + "-" : "",
2212-
prefix: prefix,
2213-
event: (lowPrefix === "o" || lowPrefix === "webkit") ? lowPrefix : ""
2214-
};
2215-
2216-
if (hasTransitions) {
2217-
transitions = transforms;
2218-
transitions.event = transitions.event ? transitions.event + "TransitionEnd" : "transitionend";
2219-
}
2220-
2221-
return false;
2222-
}
2223-
});
2224-
22252204
table = null;
2226-
2227-
support.transforms = transforms;
2228-
support.transitions = transitions;
2229-
22302205
support.devicePixelRatio = window.devicePixelRatio === undefined ? 1 : window.devicePixelRatio;
22312206

22322207
try {

src/kendo.draganddrop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ var __meta__ = {
405405
}
406406
});
407407

408-
var TRANSFORM_STYLE = support.transitions.prefix + "Transform",
408+
var TRANSFORM_STYLE = "transform",
409409
translate;
410410

411411

0 commit comments

Comments
 (0)