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

kendo child grid, dropdown list not rendering properly

5 Answers 305 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lijo
Top achievements
Rank 1
Lijo asked on 23 Jul 2019, 11:47 AM

 

I am using editor template for child grid column. It is rendering for the first child grid. Like seeing in attached picture it is not rendering for the second  child grid.

 

 columns.Bound(p => p.RoleId).EditorTemplateName("UserRole").Title(ViewBag.Location).ClientTemplate("\\#:RoleName\\#"); 

5 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 25 Jul 2019, 07:59 AM
Hello Lijo,

The described behavior is expected as the child grids have the same configuration, thus their editor names are the same. In other words, it is not possible to have two rows opened in edit mode simultaneously. A possible workaround would be to exit edit mode in all child grids before editing.

e.g.

// attach BeforeEdit event handler
 
.Events(x=> x.BeforeEdit("beforeEdit"))
 
// beforeEdit event handler
 
        function beforeEdit(e){
              $('#grid').find('.k-grid').each(function(){ // where `grid` is the name of the parent grid
                if(!$.contains($(this), e.container)){
                  $(this).data('kendoGrid').cancelRow();
                }
              })
            }


Regards,
Georgi
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
Lijo
Top achievements
Rank 1
answered on 26 Jul 2019, 05:51 AM

 

Thanks for the work around.

 

You cannot say the behavior is expected. Accept it as a bug. 

 

0
Georgi
Telerik team
answered on 29 Jul 2019, 08:15 AM
Hi Lijo,

The MVC wrappers basically generate some HTML and a initialization script which creates a jQuery widget. You can find further information regarding the server wrappers in the following article:


Please note that the name of the wrapper is then used as an id to the element which the initialization script uses to create the widget. In the context of a hierarchy grid, all child grids are basically different instances of the same grid, thus the names of the editor widgets are the same. Therefore, if you have 2 grids in edit mode, the DOM will contain few elements with the same ids - which is invalid as the id selector will always return the first occurrence and the editors within the other rows will not initialize.


Regards,
Georgi
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
Lijo
Top achievements
Rank 1
answered on 29 Jul 2019, 09:09 AM

Yes, that is a bug as per your design.

Well, kendo allowing edit functionality on child grid. Also editor template option ( Drop down list)

Then it is your responsibility to work properly. Client is laughing at me. QA team won't pass it. I cannot say editing one grid at a time is allowed. 

 

0
Georgi
Telerik team
answered on 31 Jul 2019, 08:44 AM
Hello Lijo,

The `hierarchical grid` is basically a standard grid with a detail template which contains another grid. The parent grid is not aware of those child grids, neither is the child grid aware of the parent grid. In other words the instances of those grids are not related in anyway and such limitations might occur. We will violate the separation of concerns principle if we include logic within our grid which checks whether there are any other grids surrounding it. In other words, the `hierarchical grid` is not a single component for displaying hierarchical data but a standard grid with detail template.

For displaying hierarchical data, we provide the TreeList component. You can test it in the following demo:



Regards,
Georgi
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
Lijo
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Lijo
Top achievements
Rank 1
Share this question
or