There are several problems when extending a widget .
In this example we have extended the DropDownTree.
selectedProductId: [{ id: "a" }, { id: "c" }],
and not
selectedProductId: ["b", "c"]
So some properties are supported and other that have been added later not.
I present you the source code (https://dojo.telerik.com/ewewERiD)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Untitled</title>
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2022.2.510/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2022.2.510/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2022.2.510/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2022.2.510/styles/kendo.default-ocean-blue.min.css">
</head>
<body>
<input id="dropdowntreeExt" data-bind="value: selectedProductId">
<script>
(function ($) {
var kendo = window.kendo,
ui = kendo.ui,
DropDownTree = ui.DropDownTree;
var DemoDropDownTree = DropDownTree.extend({
init: function (element, options) {
DropDownTree.fn.init.call(this, element, options);
$(element).parent().addClass("k-picker-solid k-picker k-rounded");
},
options: {
name: "DemoDropDownTree",
checkboxes: true,
fillMode: "flat"
}
});
ui.plugin(DemoDropDownTree);
})(jQuery);
var viewModel = kendo.observable({
selectedProductId: [{ id: "a" }, { id: "c" }],
//selectedProductId: ["b", "c"],
products: [
{ id: "a", name: "Coffee" },
{ id: "b", name: "Tea" },
{ id: "c", name: "Juice" }
]
});
kendo.bind($("#dropdowntreeExt"), viewModel);
//kendoDemoDropDownTree
//kendoDropDownTree
$("#dropdowntreeExt").kendoDemoDropDownTree({
valuePrimitive: true,
dataTextField: "name",
dataValueField: "id",
//checkboxes: true,
dataSource: viewModel.products//,
//fillMode: "flat"
});
alert($("#dropdowntreeExt").data("kendoDemoDropDownTree").options['fillMode']);
</script>
</body>
</html>
(!) This also applies in the latest versions as well (2022R2 and 2022R3).
2. if you place the properties in kendoDropDownTree, everything works well and the datasource also accepts the format selectedProductId: ["b", "c"]
3. Many options, like autoWidth property, don't apply in extended widgets (i.e. MultiSelect, DropDownList, DropDownTree etc).
4, In DropDownTree for the extended widget, valuePrimitive: true is not applicable. Instead of returning an array of the selected keys, it returns an array of the entire item.