Skip to content

Commit 3464242

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent b7d6c2c commit 3464242

File tree

2 files changed

+105
-2
lines changed

2 files changed

+105
-2
lines changed

docs-aspnet-mvc/helpers/grid/faq.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,73 @@ The following example demonstrates the Read-only property through the `Editable`
553553

554554
Use custom editor templates. ASP.NET MVC looks for a partial view, named after the type—for example, `DateTime.cshtml`. Telerik UI for ASP.NET MVC ships with a few ready-to-use editor templates. They are located in the `\wrappers\aspnetmvc\EditorTemplates` folder. The editor templates are available in two flavors—the `ascx` folder contains the `WebForms` view engine version, whereas the `razor` folder contains the `Razor` view engine version. To use these editor templates in your application, copy all files from the corresponding folder (`ascx` or `razor`) to `~/Views/Shared/EditorTemplates` (you may need to create this folder if it does not exist yet).
555555

556+
The following steps demonstate how to use a Kendo UI DateTimePicker to validate a date.
557+
558+
1. Add a new partial view to the `~/Views/Shared/EditorTemplates` folder—for example, KendoDateEditor.ascx or KendoDateEditor.cshtml (if using the Razor view engine).
559+
560+
1. Add a Kendo UI DropDownList to that partial view.
561+
562+
563+
```ASPX
564+
<%: Html.Kendo().DateTimePicker()
565+
.Value(DateTime.Now)
566+
.DateInput()
567+
%>
568+
```
569+
```Razor
570+
@(Html.Kendo().DateTimePicker()
571+
.Value(DateTime.Now)
572+
.DateInput()
573+
)
574+
```
575+
576+
1. Decorate the Date property in the model using the [`UIHint`](https://msdn.microsoft.com/en-us/library/cc679268) attribute.
577+
578+
579+
public class Order
580+
{
581+
public int OrderID { get; set; }
582+
583+
public string ShipCountry { get; set; }
584+
585+
[UIHint("KendoDateEditor")]
586+
public Date OrderDate { get; set; }
587+
}
588+
589+
The following steps demonstate how to use a Kendo UI NumericTextBox to validate a number.
590+
591+
1. Add a new partial view to the `~/Views/Shared/EditorTemplates` folder—for example, KendoNumberEditor.ascx or KendoNumberEditor.cshtml (if using the Razor view engine).
592+
593+
1. Add a Kendo UI DropDownList to that partial view.
594+
595+
596+
```ASPX
597+
<%: Html.Kendo().NumericTextBox()
598+
.Round(false)
599+
.Spinners(false)
600+
%>
601+
```
602+
```Razor
603+
@(Html.Kendo().NumericTextBox()
604+
.Round(false)
605+
.Spinners(false)
606+
)
607+
```
608+
609+
1. Decorate the number property in the model using the [`UIHint`](https://msdn.microsoft.com/en-us/library/cc679268) attribute.
610+
611+
612+
public class Order
613+
{
614+
public int OrderID { get; set; }
615+
616+
public string ShipCountry { get; set; }
617+
618+
[UIHint("KendoNumberEditor")]
619+
public decimal Price { get; set; }
620+
}
621+
622+
556623
## See Also
557624
558625
Other articles on the Kendo UI Grid for ASP.NET MVC:

src/kendo.dialog.js

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
KWINDOW = ".k-window",
2424
KICONCLOSE = ".k-dialog-close",
2525
KCONTENTCLASS = "k-content k-window-content k-dialog-content",
26+
KCONTENTSELECTOR = ".k-window-content",
2627
KCONTENT = ".k-content",
2728
KSCROLL = "k-scroll",
2829
KTITLELESS = "k-dialog-titleless",
@@ -39,6 +40,8 @@
3940
ZINDEX = "zIndex",
4041
BODY = "body",
4142
INITOPEN = "initOpen",
43+
TOUCHSTART = "touchstart",
44+
TOUCHMOVE = "touchmove",
4245
OPEN = "open",
4346
CLOSE = "close",
4447
SHOW = "show",
@@ -52,6 +55,7 @@
5255
HIDDEN = "hidden",
5356
OVERFLOW = "overflow",
5457
DATADOCOVERFLOWRULE = "original-overflow-rule",
58+
DATAHTMLTAPYRULE = "tap-y",
5559
HUNDREDPERCENT = 100,
5660
messages = {
5761
okText : "OK",
@@ -720,15 +724,47 @@
720724
$body.css(OVERFLOW, HIDDEN);
721725

722726
var $html = $("html");
727+
var html = $html[0];
723728
that._storeOverflowRule($html);
724729
$html.css(OVERFLOW, HIDDEN);
730+
731+
// prevent touch due to bug in ios
732+
if (kendo.support.mobileOS.ios) {
733+
html.addEventListener(TOUCHSTART, that._touchStart, { passive: false });
734+
html.addEventListener(TOUCHMOVE, that._touchMove, { passive: false });
735+
}
736+
},
737+
738+
_touchStart: function (e) {
739+
$(this).data(DATAHTMLTAPYRULE, e.changedTouches[0].pageY);
740+
},
741+
742+
_touchMove: function (e) {
743+
var target = e.target;
744+
var $target = $(e.target);
745+
var upScroll = e.changedTouches[0].pageY - $(this).data(DATAHTMLTAPYRULE) > 0;
746+
var preventYScroll = $target.is(KCONTENTSELECTOR) &&
747+
(upScroll && $target.scrollTop() === 0) ||
748+
(!upScroll && $target.scrollTop() === target.scrollHeight - target.clientHeight);
749+
if (!$target.is(KCONTENTSELECTOR) || preventYScroll) {
750+
e.preventDefault();
751+
}
725752
},
726753

727754
_enableDocumentScrolling: function(){
728755
var that = this;
756+
var $body = $(document.body);
757+
var $html = $("html");
758+
var html = $html[0];
729759

730-
that._restoreOverflowRule($(document.body));
731-
that._restoreOverflowRule($("html"));
760+
that._restoreOverflowRule($body);
761+
that._restoreOverflowRule($html);
762+
763+
if (kendo.support.mobileOS.ios) {
764+
$html.removeData(DATAHTMLTAPYRULE);
765+
html.removeEventListener(TOUCHSTART, that._touchStart, { passive: false });
766+
html.removeEventListener(TOUCHMOVE, that._touchMove, { passive: false });
767+
}
732768
},
733769

734770
_storeOverflowRule: function($element){

0 commit comments

Comments
 (0)