DatePicker in Grid Reverts to Default Value After Focus Change

2 posts, 0 answers
  1. Matthew
    Matthew avatar
    18 posts
    Member since:
    Oct 2014

    Posted 16 Oct 2015 Link to this post

    I am trying to use a datepicker in a grid column that utilizes InCell editing.  The problem I am having is that the datepicker appears to revert back to the specified default value after I remove the focus from the datepicker cell into another cell.  Another interesting thing to note is that I can click back into the datepicker cell that I changed and the datepicker will once again show the correct date that I changed the cell too.  Any ideas what causes this behavior?

    Here is the date snippet from my viewmodel:

    [DisplayFormat(DataFormatString = "{0:MMMM yyyy}")]
    public DateTime FOBDate { get; set; }


    Here is my Date.cshtml code:

    @model DateTime?
    @(Html.Kendo().DatePickerFor(m => m)
        .Format("MMMM yyyy")


    And here is my view that contains the grid:

                    .Columns(columns =>
                        columns.Bound(c => c.Category).ClientTemplate("#=Category.CategoryName#"); //.EditorTemplateName("ProductCategory");
                        columns.Bound(c => c.SKU_Name);
                        columns.Bound(c => c.MaterialNumber);
                        columns.Bound(c => c.Company).ClientTemplate("#=Company.CompanyName#");
                        columns.Bound(c => c.FOBDate).EditorTemplateName("Date");
                        columns.Bound(c => c.Price).EditorTemplateName("Price");
                    .ToolBar(toolbar =>
                    .Editable(editable => editable.Mode(GridEditMode.InCell))
                    .HtmlAttributes(new { style = "height: 500px;" })
                    .Resizable(resize => resize.Columns(true))
                    //.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
                    .DataSource(dataSource => dataSource
                        .Events(events => events.Error("error_handler"))
                        .Model(model =>
                            model.Id(c => c.FOBID);
                            model.Field(c => c.FOBID).Editable(false);
                            model.Field(c => c.Category).DefaultValue(ViewData["defaultCategory"] as TestMACPortal.Models.ProductCategoryViewModel);
                            model.Field(c => c.Company).DefaultValue(ViewData["defaultCompany"] as TestMACPortal.Models.CompanyViewModel);
                            model.Field(c => c.FOBDate).DefaultValue(DateTime.Today);
                        //.Destroy("Editing_Destroy", "FOB")
                        .Read(read =>
                            read.Action("GetFOBs", "FOB");
                    //.Create("CreateFOB", "FOB")
                    //.Update("UpdateFOB", "FOB")





  2. Georgi Krustev
    Georgi Krustev avatar
    3725 posts

    Posted 20 Oct 2015 Link to this post

    Hello Matthew,

    I am afraid that it is not very clear why the editing with the custom date format does not work well. It could be related to missing custom validation rule for this format or a missing format to the bound column.
    Could you modify the attached demo and demonstrate the issue? This will help us to narrow the problem down much faster.

    Georgi Krustev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top