Skip to content

Commit dcded6c

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 2511538 commit dcded6c

File tree

3 files changed

+49
-7
lines changed

3 files changed

+49
-7
lines changed

docs/api/javascript/ui/treelist.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5708,6 +5708,11 @@ A string, a DOM element, or a jQuery object which represents the table row. A st
57085708
});
57095709
</script>
57105710

5711+
### getOptions
5712+
5713+
Retrieves the options that are currently enabled or disabled on the Treelist, also gives the current state of the dataSource.
5714+
Use this method if you want to save the state of the Treelist into a variable. It is also possible to extract and store only some of the Treelist options.
5715+
57115716
### itemFor
57125717

57135718
(Available as of the 2015.3.930 release) Returns the rendered HTML element for a given model.
@@ -6096,6 +6101,22 @@ The data source to which the widget will be bound.
60966101
});
60976102
</script>
60986103

6104+
### setOptions
6105+
6106+
Sets the options of the Treelist. Use this method if you want to enable/disable a particular feature/option or to load
6107+
the complete state obtained previously with the [`getOptions`](getoptions) method.
6108+
6109+
When `setOptions` is called, the Treelist widget will be destroyed and recreated. If the widget is bound to remote data, a new read request will be made.
6110+
6111+
> There are a few important things to keep in mind when using `getOptions` and `setOptions`.
6112+
>
6113+
> * **calling `setOptions()` in a Treelist event handler is not possible.**
6114+
> * **calling `setOptions()` in a function, which is related to the Treelist's databinding mechanism may cause an endless loop.**
6115+
> * `JSON.stringify()` cannot serialize function references (e.g. event handlers), so if stringification is used for the retrieved Treelist state,
6116+
> all configuration fields, which represent function references, will be lost. You have two options to avoid this limitation:
6117+
> use a [custom implementation](https://github.com/tarruda/super-json) to serialize JavaScript functions, or
6118+
> add the function references back to the deserialized configuration object before passing it to the `setOptions` method.
6119+
60996120
### showColumn
61006121

61016122
Shows the specified column.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"version": "1.0.0",
1212
"dependencies": {},
1313
"devDependencies": {
14-
"@progress/kendo-theme-bootstrap": "4.23.0",
15-
"@progress/kendo-theme-default": "4.25.0",
16-
"@progress/kendo-theme-material": "3.21.0",
14+
"@progress/kendo-theme-bootstrap": "4.24.0",
15+
"@progress/kendo-theme-default": "4.26.0",
16+
"@progress/kendo-theme-material": "3.22.0",
1717
"amd-optimize": "0.6.1",
1818
"autoprefixer": "^9.1.5",
1919
"bootstrap": "^4.0.0",

src/kendo.validator.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,23 @@ var __meta__ = { // jshint ignore:line
114114
return containers;
115115
}
116116

117+
function isLabelFor(label, element) {
118+
if (!label) {
119+
return false;
120+
}
121+
if (typeof label.nodeName !== 'string' || label.nodeName !== 'LABEL') {
122+
return false;
123+
}
124+
if (typeof label.getAttribute('for') !== 'string' || typeof element.getAttribute('id') !== 'string') {
125+
return false;
126+
}
127+
if (label.getAttribute('for') !== element.getAttribute('id')) {
128+
return false;
129+
}
130+
131+
return true;
132+
}
133+
117134
var SUMMARYTEMPLATE = '<ul>' +
118135
'#for(var i = 0; i < errors.length; i += 1){#' +
119136
'<li><a data-field="#=errors[i].field#" href="\\#">#= errors[i].message #</a></li>' +
@@ -391,15 +408,19 @@ var __meta__ = { // jshint ignore:line
391408
var widgetInstance = kendo.widgetInstance(input);
392409
var parentElement = input.parent().get(0);
393410
var nextElement = input.next().get(0);
411+
var prevElement = input.prev().get(0);
394412

395-
if (parentElement && parentElement.nodeName === "LABEL") {
413+
if (widgetInstance && widgetInstance.wrapper) {
414+
messageLabel.insertAfter(widgetInstance.wrapper);
415+
} else if (parentElement && parentElement.nodeName === "LABEL") {
396416
// Input inside label
397417
messageLabel.insertAfter(parentElement);
398-
} else if (nextElement && nextElement.nodeName === "LABEL") {
418+
} else if (nextElement && isLabelFor(nextElement, input[0])) {
399419
// Input before label
400420
messageLabel.insertAfter(nextElement);
401-
} else if (widgetInstance && widgetInstance.wrapper) {
402-
messageLabel.insertAfter(widgetInstance.wrapper);
421+
} else if (prevElement && isLabelFor(prevElement, input[0])) {
422+
// Input after label
423+
messageLabel.insertAfter(input);
403424
} else {
404425
messageLabel.insertAfter(input);
405426
}

0 commit comments

Comments
 (0)