This is a migrated thread and some comments may be shown as answers.

Adding a datetime picker inside a dropdown field

1 Answer 455 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Dragos
Top achievements
Rank 1
Dragos asked on 21 Dec 2015, 09:45 AM

Hello gents,

Is there a way to do a datetimepicker inside a kendo ui dropdown list . What i want to accomplish is this: have a select and the default option to be a date time picker and the other options to be some data that i bring via a .net controller.( i wanna do this dynamically for i don't know if i have data or not ).Also it must be a widget so that's why i attached the following code

I have tried the  following :

<script>
    (function () {
        var kendo = window.kendo,
            ui = kendo.ui,
            Widget = ui.Widget,

        CHANGE = "change";

        var RangeSelector = Widget.extend({
            init: function (element, options) {
                var that = this;

                debugger;
                kendo.ui.Widget.fn.init.call(that, element, options);
                that.template = kendo.template(that.options.template);

                that._dataSource();
            },
            options: {
                name: "RangeSelector",
                autoBind: true,
                template: "<ul><li id='default'/></li></ul>"
            },
            refresh: function () {
                var that = this,
                    view = that.dataSource.view(),
                    html = kendo.render(that.template, view);

                that.element.html(html);
            },
            _dataSource: function () {
                var that = this;
                // returns the datasource OR creates one if using array or configuration object

                that.dataSource = kendo.data.DataSource.create(that.options.dataSource);

                // bind to the change event to refresh the widget
                that.dataSource.bind(CHANGE, function () {
                    that.refresh();
                });

                if (that.options.autoBind) {
                    that.dataSource.fetch();
                }
            }
        });

        ui.plugin(RangeSelector);

    })(jQuery);
</script>

<script>


    $("#rangeSelector").kendoRangeSelector({
        dataSource: ["item1", "item2", "item3"]
    });

    $('#default').kendoDateTimePicker({
        format: "MM/dd/yyyy hh:mm tt"
    });

</script>

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 23 Dec 2015, 11:05 AM
Hi Dragos,

Inserting DatePicker inside Kendo DropDownList is not supported. Please consider using two separate widgets.

Another possible option is to develop custom widget that suits to your requirements. I will not be able to provide guidance for that as it is out of the scope of our support services.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Templates
Asked by
Dragos
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or