Pending Review
Last Updated: 27 Sep 2022 11:08 by Athanasios
Created by: Athanasios
Comments: 0
Category: Kendo UI for jQuery
Type: Bug Report
0

There are several problems when extending a widget .
In this example we have extended the DropDownTree.

  1. Some properties like fillMode, no matter if we set in in the options or in the extended widget it self (kendoDemoDropDownTree)
    sets the value but never actually applies. Also the dataSource must be in the following format 

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.

 

Pending Review
Last Updated: 09 Sep 2022 06:29 by ADMIN

Add a hidden input to store the current value in it at all times, and a visible display input that has the month/day/year or current value displayed in it; it solved all of the issues and is currently implemented on numerous other Kendo form input controls.

This will make the DateInput compatible with JQuery Unobtrusive Validation.