Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In the below code:
JavaScript
var grid = $('#grid1').data('kendoGrid');
var f = grid.tbody.find('tr.k-grouping-row');
grid.tbody.find('tr.k-grouping-row').each(function (e) { grid.collapseRow(this); });
console.log(grid.tbody.children().length);

Why grid.tbody.children().length is 0 while grid.tbody has 11 children?

Thanks for response!

What I have tried:

I try to use grid.tbody[0].children() but I encounter that grid.tbody[0].children() is not defined.
Posted
Updated 16-Jul-16 0:14am
v2
Comments
Karthik_Mahalingam 16-Jul-16 3:20am    
grid.tbody.children().length
this works fine..
bahman.01 16-Jul-16 3:22am    
But for me it doesn't work correctly. It shows 0.
Karthik_Mahalingam 16-Jul-16 3:24am    
what you are getting in this
grid.tbody.children()
check in console window
bahman.01 16-Jul-16 4:39am    
When I write
console.log(grid.tbody);
It has children but when I write
console.log(grid.tbody.children());
No child has been shown.
Karthik_Mahalingam 16-Jul-16 5:15am    
How you know that children is there

1 solution

Use it as property
JavaScript
grid.tbody.children;


not method
C#
grid.tbody.children()
 
Share this answer
 
Comments
bahman.01 16-Jul-16 6:26am    
but this is the output:
https://lh3.googleusercontent.com/NNrfYkDMw6rta287-oGUmoTuTag-4TlhjsLdgJAuFcKKwLeqG7GDVgJtYr8u-_1LHsKNfjmGq708AZWGpFjArKCy3BCkArguXcEMv_S1q6ullXb4GEpKWs-kcP9xjfmKIzAWzK5V-qjuWVsb-TBC1mRyZYVW4t9MKAYkwKfj9qw82aDXhASHCbleTA94cT2uwOMiHjbzCVORmK7EY0ajtZh_RwW6-08VqA1zeTzmoVJEHGKTTs6xnexOW2z-K1AVQz_MY0SUaZ3oCnMgXO4-DfhE0R2kzM2MMeKfKj3ck1XM4KlaSdz6dFb00Va6xM_V92-0ZQDvveM9jo60BYtUwnEng26Nt7YI5-q_5F7l-lyDHnwm4rvJ4cWpTRpUelArGBR9kDLJOb4Z5SmMne7IbYfxoGI7Y4eFVUd66KljVuZSPNF2ybrUgqk5U43fK9HOPGqCD8mUhZYjN_zgqRUs0OC7AUS9KbMQNDH-bXxMGUQ-yTZwnEmdZN6Kdpuh9_WO2qVYJ9Ie7lH3xCW_k4fbs6WeJZoOARXketlNImkjvEcP8zt5LLPOHABVlQIArQYdPSHj-8b-EO5W_hDBwdE2tSGx2QFXHDc=w487-h126-no

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900