1

I have a datepicker in my kendo grid. This datepicker has been set so that user can be able to select only today's date as minimum. But suppose I selected 07/04/2016 (mm/dd/yyyy) as today's date and saved it. I check this record tomorrow for editing, It does not shows up this date, when grid is in edit mode as this date is now old than today.

How can I set past date to datepicker for only viewing and not selecting the previous date than today. there have been a question that has already been asked. The problem is same but my datepicker is in grid. How can I will be able to achieve this.

Grid field:
 columns: [   { field: "ExpDate", title: "Expiry Date", width: 300, filterable: false, editor: dateTimeEditor, format: "{0:MM/dd/yyyy}" },
],

//Java script function
function dateTimeEditor(container, options) {

        $('<input onkeydown="return false" data-text-field="' + options.field + '" data-value-field="' + options.field + '" data-bind="value:' + options.field + '" data-format="' + options.format + '"/>')
                .appendTo(container)
                .kendoDatePicker({
                    value: new Date(options.model.ExpDate)
                    ,min: new Date()
            });
    }
Community
  • 1
  • 1
Sandy
  • 275
  • 3
  • 8
  • 25

1 Answers1

0

Please try with the below code snippet.

function dateTimeEditor(container, options) {
    var expdatepic = $('<input onkeydown="return false" data-bind="value:' + options.field + '"/>')
            .appendTo(container)
            .kendoDatePicker({
                value: new Date(options.model.ExpDate)
            });
    var datepicker = $(expdatepic).data("kendoDatePicker");
    datepicker.min(new Date());
}

Let me know if any concern.

Jayesh Goyani
  • 11,008
  • 11
  • 30
  • 50