Skip to content

Commit 888233b

Browse files
committed
Sync with Kendo UI Professional
1 parent eeae6c0 commit 888233b

File tree

5 files changed

+86
-10
lines changed

5 files changed

+86
-10
lines changed

docs-aspnet/html-helpers/data-management/grid/faq.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,37 @@ To validate a number by using the Kendo UI NumericTextBox:
858858
public decimal Price { get; set; }
859859
}
860860
861+
## How can I distinguish between Add and Edit mode?
862+
863+
To distinguish between the insert and update modes, you can use the `isNew` method in combination with the edit event handler of the grid:
864+
[Grid Edit Event](http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-edit)
865+
866+
Here is a basic sample for reference:
867+
868+
```HtmlHelper
869+
// Omitted for brevity.
870+
.Events(events => events.Edit("onEdit"))
871+
```
872+
{% if site.core %}
873+
```TagHelper
874+
<kendo-grid on-edit="onEdit">
875+
// Omitted for brevity.
876+
</kendo-grid>
877+
```
878+
{% endif %}
879+
```js
880+
function onEdit(args) {
881+
if (args.model.isNew() == false) {
882+
// textbox
883+
$("#ShipName").attr("readonly", true);
884+
885+
// dropdownlist
886+
var kendoDdl = $("#ShipCountry").data("kendoDropDownList");
887+
kendoDdl.readonly(true);
888+
}
889+
}
890+
```
891+
861892
## See Also
862893

863894
* [Basic Usage of the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid)

docs-aspnet/html-helpers/navigation/treeview/binding.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ public static IList<HierarchicalViewModel> GetHierarchicalData()
219219
{
220220
var result = new List<HierarchicalViewModel>()
221221
{
222-
new HierarchicalViewModel() { ID = 1, ParendID = null, HasChildren = true, Name = "Parent item" },
223-
new HierarchicalViewModel() { ID = 2, ParendID = 1, HasChildren = true, Name = "Parent item" },
224-
new HierarchicalViewModel() { ID = 3, ParendID = 1, HasChildren = false, Name = "Item" },
225-
new HierarchicalViewModel() { ID = 4, ParendID = 2, HasChildren = false, Name = "Item" },
226-
new HierarchicalViewModel() { ID = 5, ParendID = 2, HasChildren = false, Name = "Item" }
222+
new HierarchicalViewModel() { ID = 1, ParentID = null, HasChildren = true, Name = "Parent item" },
223+
new HierarchicalViewModel() { ID = 2, ParentID = 1, HasChildren = true, Name = "Parent item" },
224+
new HierarchicalViewModel() { ID = 3, ParentID = 1, HasChildren = false, Name = "Item" },
225+
new HierarchicalViewModel() { ID = 4, ParentID = 2, HasChildren = false, Name = "Item" },
226+
new HierarchicalViewModel() { ID = 5, ParentID = 2, HasChildren = false, Name = "Item" }
227227
};
228228
229229
return result;
@@ -232,7 +232,7 @@ public static IList<HierarchicalViewModel> GetHierarchicalData()
232232
public ActionResult Read_TreeViewData(int? id)
233233
{
234234
var result = GetHierarchicalData()
235-
.Where(x => id.HasValue ? x.ParendID == id : x.ParendID == null)
235+
.Where(x => id.HasValue ? x.ParentID == id : x.ParentID == null)
236236
.Select(item => new {
237237
id = item.ID,
238238
Name = item.Name,

docs-aspnet/knowledge-base/custom-column-popup-editor.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,17 @@ For the complete implementation of the suggested approach, refer to the followin
121121
* [{{ site.framework }} Grid Demos](https://demos.telerik.com/{{ site.platform }}/grid/index)
122122

123123
{% if site.core %}
124+
* [{{ site.framework }} Grid Custom PopUp Editor Example](https://github.com/telerik/ui-for-aspnet-core-examples/blob/master/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Grid/CustomPopUpEditor.cshtml)
125+
124126
* [{{ site.framework }} Grid Product Page](https://www.telerik.com/aspnet-core-ui/grid)
125127

126128
* [Telerik UI for {{ site.framework }} Video Onboarding Course (Free for trial users and license holders)]({%slug virtualclass_uiforcore%})
127129

128130
* [Telerik UI for {{ site.framework }} Forums](https://www.telerik.com/forums/aspnet-core-ui)
129131

130132
{% else %}
133+
* [{{ site.framework }} Grid Custom PopUp Editor Example](https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Areas/GridEditingCustomPopupEditor)
134+
131135
* [{{ site.framework }} Grid Product Page](https://www.telerik.com/aspnet-mvc/grid)
132136

133137
* [Telerik UI for {{ site.framework }} Video Onboarding Course (Free for trial users and license holders)]({%slug virtualclass_uiformvc%})

src/kendo.autocomplete.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ var __meta__ = {
401401
var that = this,
402402
key = that._last,
403403
value = that._accessor(),
404+
currentValue = that.value(),
404405
element = that.element[0],
405406
caretIdx = caret(element)[0],
406407
separator = that._separator(),
@@ -429,8 +430,8 @@ var __meta__ = {
429430
caretIdx = (accentFoldingFiltering ? value.toLocaleLowerCase(accentFoldingFiltering) : value.toLowerCase()).indexOf(accentFoldingFiltering ? word.toLocaleLowerCase(accentFoldingFiltering) : word.toLowerCase()) + 1;
430431
}
431432

432-
idx = value.substring(0, caretIdx).lastIndexOf(separator);
433-
idx = idx > -1 ? caretIdx - (idx + separator.length) : caretIdx;
433+
idx = value.substring(0, caretIdx).lastIndexOf(that._defaultSeparator());
434+
idx = idx > -1 ? caretIdx - (idx + that._defaultSeparator().length) : caretIdx;
434435
value = words[wordIndex].substring(0, idx);
435436

436437
if (word) {
@@ -452,7 +453,20 @@ var __meta__ = {
452453

453454
words[wordIndex] = value;
454455

455-
that._accessor(words.join(separator || ""));
456+
if (typeof that.options.separator == 'object' && that.options.separator != null) {
457+
if (currentValue.length > 1) {
458+
let lastSeparator = [...currentValue.matchAll(separator.source)].pop();
459+
if (lastSeparator) {
460+
that._accessor(words.slice(0, -1).join(that._defaultSeparator() || "") + lastSeparator + words[words.length - 1]);
461+
} else {
462+
that._accessor(words.slice(0, -1).join(that._defaultSeparator() || ""));
463+
}
464+
} else {
465+
that._accessor(words.join(this._defaultSeparator() || ""));
466+
}
467+
} else {
468+
that._accessor(words.join(separator || ""));
469+
}
456470

457471
if (element === activeElement()) {
458472
caret(element, caretIdx, selectionEnd);
@@ -752,7 +766,18 @@ var __meta__ = {
752766
_move: function(action) {
753767
this.listView[action]();
754768

755-
if (this.options.suggest) {
769+
if (this.options.suggest && this.listView.focus() == null && action == "focusNext") {
770+
this.listView.focus(0);
771+
this.suggest(this.listView._view[0].item);
772+
} else if (this.options.suggest && this.listView.focus() == null && action == "focusPrev") {
773+
let index = this.listView._view.length - 1;
774+
this.listView.focus(index);
775+
this.suggest(this.listView._view[index].item);
776+
} else if (this.options.suggest && action == "focusFirst") {
777+
caret(this.element)[0];
778+
} else if (this.options.suggest && action == "focusLast") {
779+
caret(this.element)[this.element.val().length - 1];
780+
} else if (this.options.suggest && this.listView.focus() != null) {
756781
this.suggest(this.listView.focus());
757782
}
758783
},

tests/autocomplete/separator.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,22 @@ it("select replaces the word at the caret position", function() {
117117
autocomplete.search();
118118
});
119119

120+
it("multiple separators, suggest correct word", function() {
121+
var autocomplete = new AutoComplete(input, {
122+
separator: [", ", ": ", "; "],
123+
suggest: true,
124+
dataSource: {
125+
data: ["baz", "bar"]
126+
}
127+
});
128+
129+
input.focus();
130+
input.type("b");
131+
autocomplete.search();
132+
133+
assert.equal(input.val(), "baz, ");
134+
});
135+
120136
it("multiple separators, replace all with default separator", function() {
121137
var autocomplete = new AutoComplete(input, {
122138
dataSource: ["baz", "bar"],

0 commit comments

Comments
 (0)