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

PopUp not working for adding new entry

3 Answers 377 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christos
Top achievements
Rank 1
Christos asked on 11 Jul 2019, 11:37 AM
Hello,

I created an edit-pop up template for a grid and when I try to edit the entry, the pop up works great. But the template is not loading when I click to add a new entry.

e.g.

Html.Kendo().Grid<Areas.TestArea.Models.RoleBasicFunctions>()
                                                .Name("RoleBasicFunctions")
                                               .Columns(columns =>
                                               {
                                                           columns.Bound(p => p.RoleBasicFunctionsID).Title("ID").Visible(false);
                                                           columns.Bound(p => p.EntityBasicInformation.EntityType.EntityTypeName).Title("Entity Name").HeaderHtmlAttributes(new { style = "white-space: normal" });
                                                           columns.Bound(p => p.EntityBasicInformation.Name).Title("Name").HeaderHtmlAttributes(new { style = "white-space: normal" });
                                                           columns.Command(command => { command.Edit().Text(" "); }).Width(80);
                                                       })
                                                .Pageable()
                                                .Sortable()
                                                .Scrollable()
                                                .Editable(editable => editable.Mode(GridEditMode.PopUp).DisplayDeleteConfirmation(false).TemplateName("EditRoleBasicFunctions").Window(ww => ww.Title("Edit").Width(1800)))
                                                .ToolBar(toolbar => toolbar.Create())
                                                .Filterable()
                                                .DataSource(dataSource => dataSource.Ajax()
                                                .Model(model =>
                                                {
                                                            model.Id(p => p.RoleBasicFunctionsID);
                                                        })
                                                .Read(read => read.Action("RoleBasicFunctionsGrid_Read", "Test").Data("additionalData")))

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 16 Jul 2019, 07:13 AM
Hello Christos,

Would you specify default values for the fields bound to the Grid columns and see how the behavior changes? In case the issue persists please open the browser console by pressing F12 and see if there are errors listed. In case there are that can point us in the right direction.

Additionally it would be great if you can send us a runnable sample where the issue is replicated. This will enable us to examine the behavior locally and look for its cause.


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Christos
Top achievements
Rank 1
answered on 16 Jul 2019, 07:40 AM

Dear Viktor,

 

thank you for your reply. The error listed is:

VM4145:3 Uncaught TypeError: Cannot read property 'EntityType' of undefined

Best Regards,

Christos

0
Viktor Tachev
Telerik team
answered on 19 Jul 2019, 06:13 AM
Hello Christos,

Would you set a default value for EntityBasicInformation in the DataSource Model configuration? The configuration would look similar to the one for the Category field in the example below:



.Model(model =>
{
    model.Id(p => p.RoleBasicFunctionsID);
    model.Field(p => p.RoleBasicFunctionsID).Editable(false);
    model.Field(p => p.EntityBasicInformation).DefaultValue(
        ViewData["defaultBasicInformation"] as Areas.TestArea.Models.EntityBasicInformationModel);
})


That said, it would be great if you send us a runnable sample where the error is replicated. This will enable us to examine the issue locally and look for its cause.



Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Christos
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Christos
Top achievements
Rank 1
Share this question
or