python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
kendo ui grid total row get total number of rows in a grid

kendo ui grid total row count

Hello everyone, I am going to share the code sample for 
"get total number of rows in a kendo ui grid".

Code sample for MVC 4 kendo Grid


@(Html.Kendo().Grid<PCX.Models.Use>()
    .Name("CallByCallUsage")
                    .Groupable()
                    .Sortable()
                    .Pageable()
                    .Scrollable()
            .Columns(columns =>
            {
                columns.Bound(e => e.AParty_Subscriber).Title("A Party");
                columns.Bound(e => e.BParty);
                columns.Bound(e => e.Date_Time).Format("{0:dd-mm-yyyy / h:mm:ss}").Title("Date & Time");
                columns.Bound(e => e.NetworkID).Title("Network").ClientTemplate("#: getNetworkName(NetworkID) #");
                columns.Bound(e => e.CallType);
                columns.Bound(e => e.Location);
                columns.Bound(e => e.CallDirection);
                columns.Bound(e => e.Unit);
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model => model.Id(p => p.ID))
                .Read(read => read.Action("GetUsage", "Api/Use").Type(HttpVerbs.Get).Data("sendData"))
            )
    )

Code sample for JavaScript

<script type="text/javascript">
    $(document).ready(function () {
        totalNoOfRows();
        sendData();
    });

    function sendData() {
        return {
            TenantID: '@userSession.TenantID',
            CompanyID: '@userSession.CompanyID'
        };
    }

    function totalNoOfRows() {
        var kendoGrid = $("#CallByCallUsage").data("kendoGrid");

        //THis is for get the length of grid.
        var grdLength = kendoGrid.dataSource.view().length;
        console.log(grdLength);

        //This is for get total no of records.
        var grdTotal = kendoGrid.dataSource.total();
        console.log(grdTotal);
    }
</script>


ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions