Skip to content

Commit a5482d1

Browse files
committed
Sync with Kendo UI Professional
1 parent 8b5f64d commit a5482d1

File tree

4 files changed

+88
-26
lines changed

4 files changed

+88
-26
lines changed

docs-aspnet/html-helpers/editors/autocomplete/binding/model-binding.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ You can configure the AutoComplete to get its data from a remote source by makin
5555
5656
1. Create an action that returns the data as a JSON result.
5757
58+
{% if site.mvc %}
59+
```C#
5860
public ActionResult Index()
5961
{
6062
return View(new ProductViewModel
@@ -75,6 +77,31 @@ You can configure the AutoComplete to get its data from a remote source by makin
7577
return Json(products, JsonRequestBehavior.AllowGet);
7678
}
7779
80+
```
81+
{% else %}
82+
```C#
83+
public ActionResult Index()
84+
{
85+
return View(new ProductViewModel
86+
{
87+
ProductID = 4,
88+
ProductName = "ProductName4"
89+
});
90+
}
91+
92+
public JsonResult GetProductsAjax()
93+
{
94+
var products = Enumerable.Range(0, 500).Select(i => new ProductViewModel
95+
{
96+
ProductID = i,
97+
ProductName = "ProductName" + i
98+
});
99+
100+
return Json(products);
101+
}
102+
103+
```
104+
{% endif %}
78105
79106
1. Add the AutoComplete to the view and configure its DataSource to use remote data.
80107

docs-aspnet/html-helpers/editors/autocomplete/binding/razor-pages.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ For the complete project, refer to the [AutoComplete in Razor Pages example](htt
2020

2121
In order to set up the AutoComplete component bindings, you need to configure the `Read` method of its `DataSource` instance. The URL in this method should refer the name of the method in the PageModel. In this method, you can also pass additional parameters, such as filter string and antiforgery token (see `dataFunction`).
2222

23-
```tab-HtmlHelper(csthml)
23+
```tab-HtmlHelper(cshtml)
24+
@model IndexModel
25+
2426
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
2527
@Html.AntiForgeryToken()
2628
27-
@(Html.Kendo().AutoComplete()
28-
.Name("autocomplete")
29+
@(Html.Kendo().AutoCompleteFor(model => model.ShipName)
2930
.DataTextField("ShipName")
3031
.Filter("contains")
3132
.MinLength(3)
@@ -53,30 +54,36 @@ In order to set up the AutoComplete component bindings, you need to configure th
5354
```
5455
{% if site.core %}
5556
```TagHelper
56-
<kendo-autocomplete name="autocomplete"
57-
datatextfield="ShipName"
58-
filter="FilterType.Contains"
59-
min-length="3">
60-
<datasource type="DataSourceTagHelperType.Custom"
61-
server-filtering="true">
62-
<transport>
63-
<read url="/AutoComplete/AutoCompleteCRUDOperations?handler=Read" data="dataFunction" />
64-
</transport>
65-
</datasource>
66-
67-
</kendo-autocomplete>
57+
<kendo-autocomplete for="ShipName"
58+
datatextfield="ShipName"
59+
filter="FilterType.Contains"
60+
min-length="3">
61+
<datasource type="DataSourceTagHelperType.Custom"
62+
server-filtering="true">
63+
<transport>
64+
<read url="/AutoComplete/AutoCompleteCRUDOperations? handler=Read" data="dataFunction" />
65+
</transport>
66+
</datasource>
67+
68+
</kendo-autocomplete>
6869
```
6970
{% endif %}
7071
```tab-PageModel(cshtml.cs)
71-
public JsonResult OnGetRead(string filterValue)
72+
public class IndexModel : PageModel
7273
{
73-
if (filterValue != null)
74+
[BindProperty]
75+
public string ShipName { get; set; }
76+
77+
public JsonResult OnGetRead(string filterValue)
7478
{
75-
//orders is the DBContext
76-
var filteredData = orders.Where(p => p.ShipName.Contains(filterValue));
77-
return new JsonResult(filteredData);
79+
if (filterValue != null)
80+
{
81+
//orders is the DBContext
82+
var filteredData = orders.Where(p => p.ShipName.Contains (filterValue));
83+
return new JsonResult(filteredData);
84+
}
85+
return new JsonResult(orders);
7886
}
79-
return new JsonResult(orders);
8087
}
8188
```
8289

src/kendo.numerictextbox.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ var __meta__ = {
318318

319319
if (options.value !== undefined) {
320320
that.value(options.value);
321+
} else if (that._value !== undefined) {
322+
that.value(that._value);
321323
}
322324
},
323325

@@ -371,7 +373,7 @@ var __meta__ = {
371373
adjusted = that._adjust(value);
372374

373375
if (value !== adjusted) {
374-
return;
376+
value = NULL;
375377
}
376378

377379
that._update(value);

tests/numerictextbox/api.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@
533533
kendo.culture('en-EN');
534534
});
535535

536-
it("NumericTextBox setOptons works as expected", function() {
536+
it("NumericTextBox setOptions works as expected", function() {
537537
var textbox = new NumericTextBox(input, {
538538
min: 1,
539539
max: 20,
@@ -555,7 +555,33 @@
555555
assert.equal(textbox.value(), 14);
556556
});
557557

558-
it("NumericTextBox setOptons correctly shows spinners", function() {
558+
it("NumericTextBox setOptions max property is smaller than initial value", function() {
559+
var textbox = new NumericTextBox(input, {
560+
value: 10,
561+
placeholder: "test"
562+
});
563+
textbox.setOptions({
564+
max: 5,
565+
placeholder: "new holder"
566+
});
567+
568+
assert.equal(textbox.value(), null);
569+
});
570+
571+
it("NumericTextBox setOptions max property is larger than initial value", function() {
572+
var textbox = new NumericTextBox(input, {
573+
value: 10,
574+
placeholder: "test"
575+
});
576+
textbox.setOptions({
577+
max: 15,
578+
placeholder: "new holder"
579+
});
580+
581+
assert.equal(textbox.value(), 10);
582+
});
583+
584+
it("NumericTextBox setOptions correctly shows spinners", function() {
559585
var textbox = new NumericTextBox(input, {
560586
spinners: false
561587
});
@@ -580,7 +606,7 @@
580606
assert.equal(textbox.value(), 11);
581607
});
582608

583-
it("NumericTextBox setOptons correctly sets spinners size", function() {
609+
it("NumericTextBox setOptions correctly sets spinners size", function() {
584610
var textbox = new NumericTextBox(input, {
585611
spinners: true
586612
});
@@ -593,7 +619,7 @@
593619
assert.equal(textbox._arrowsWrap.find(".k-button-lg").length, 2);
594620
});
595621

596-
it("NumericTextBox setOptons correctly hides spinners", function() {
622+
it("NumericTextBox setOptions correctly hides spinners", function() {
597623
var textbox = new NumericTextBox(input, {
598624
spinners: true
599625
});

0 commit comments

Comments
 (0)