Dynamic Grid column editor template is sending null data

2 posts, 0 answers
  1. Alex
    Alex avatar
    76 posts
    Member since:
    May 2015

    Posted 19 Dec 2017 Link to this post

    We are using a Grid with a dynamic type. This has been working for us until we ran into the problem of a column editor template receiving null data. The editor template accepts non-nullable TimeSpans but when the grid initializes it is trying to send this editor template a null TimeSpan object. When I change the grid to one of the classes it should be getting such as DownTimeViewModel this error doesn't happen.


    "Message: The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type 'System.TimeSpan'."


          .Columns(columns =>
              foreach (Field field in cols)
                  if (string.IsNullOrWhiteSpace(field.EditorTemplateName))
                      throw new NotImplementedException("EditorTemplate is not set and it needs to be");
          .ToolBar(toolbar =>
              toolbar.Custom().Text("Delete").Action("Grid_Delete", "Downtime", new { WONumber = Model.WONumber });
          .Editable(editable => editable.Mode(GridEditMode.InCell))
          .DataSource(dataSource => dataSource
            .Model(model =>
                foreach (Field field in cols)
                foreach (Field field in cols)
                    model.Field(field.Member, field.MemberType).DefaultValue(field.DefaultValue).Editable(field.Editable);
              .Read(read => read.Action("Grid_Read", "Downtime", new { id = Model.WONumber.ToString() }))
              .Create(create => create.Action("Grid_Create", "Downtime"))
              .Update(update => update.Action("Grid_Update", "Downtime"))
              .Destroy(destroy => destroy.Action("Grid_Delete", "Downtime"))



  2. Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 21 Dec 2017 Link to this post

    Hello Alex,

    Could you please share the Editor template that you are using for the TimeSpan field and if possible, share the "cols" collection that you are using (or at least one that replicates the issue). Thus we will be able to create a runnable example on our end with the same Grid configuration and suggest a solution for the problem.

    Looking forward to your reply.

    Konstantin Dikov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top