How to get the grid's rows count ? alert($('#Grid').data("kendoGrid").tbody.find('>tr.k-master-row').length); seems not right

4 posts, 0 answers
  1. PEIYANG
    PEIYANG avatar
    65 posts
    Member since:
    Jul 2012

    Posted 09 Apr 2013 Link to this post

    How to get the grid's rows count ?My grid has data,but the code shows 0 row..
    alert($('#Grid').data("kendoGrid").tbody.find('>tr.k-master-row').length);
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 10 Apr 2013 Link to this post

    Hi Peiyang,


    The provided code seems correct for getting the count of the master rows in the Grid. 
    E.g.
    var grid = $("#grid").data("kendoGrid");
    var masterRowsCount = grid.tbody.find('>tr.k-master-row').length;

    This code should be executed after the Grid has bounded the data. You might receive 0 if you are calling it before that.

     

    Greetings,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. hiroshi
    hiroshi avatar
    1 posts
    Member since:
    Apr 2016

    Posted 12 May in reply to Dimiter Madjarov Link to this post

    var grid = $("#grid").data("kendoGrid");
    var masterRowsCount = grid.tbody.find('>tr.k-master-row').length;
  5. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 12 May Link to this post

    Hello hiroshi,

    Are you experiencing an issue with the provided sample code?

    Regards,
    Dimiter Madjarov
    Telerik
    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
UI for ASP.NET MVC is VS 2017 Ready