Get Kendo Grid Clicked (Selected) Row values using jQuery

Last Reply one month ago By dharmendr

Posted one month ago

I have an onchange event for kendogrid where i am able to get the clicked row values into the variable and now i am try to do it for onclick event instead of onchange and i had made the below changes

added onclick='onChange(this) and calling the function onChange(this) using this function i am getting 

var selectedItem = grid.dataItem(grid.select()); 

selecteditem to null

   function BindDetails(dataColl) {
       EnabledFilter = false;
       FilterPageNumber = 0;
       CallLogsetScrollPosition = true;
        $('#div1').html('');
        $('#div1').kendoGrid({
            reorderable: true,
            scrollable: true,
            resizable: true,
            height: 200,
            pageable: true,
            selectable: "single",
            click: onChange, 
            sortable: {
                mode: "single",
                allowUnsort: false,
                change: function (e) {
 
                }
            },
            pageable: {
                refresh: true,
                pageSizes: [25, 50],
                change: function (e) {
                    if (CLPCurrentPage != $("#div1").data("kendoGrid").dataSource.page()) {
                        CLPCurrentPage = $("#div1").data("kendoGrid").dataSource.page();
                    }
                }
            },
            dataBound: onGridDataBound,
            dataSource: {
                data: dataColl, pageSize: CLPCurrentPageSize
                , page: CLPCurrentPage,
                sort: {
                    field: CLPCurrentSortField,
                    dir: CLPCurrentSortDirection,
                    change: function (e) {
 
                    }
                },
                serverSorting: true,
                serverPaging: true,
                schema: {
                    total: function (dataColl) {
                        return dataColl[0].Count;
                    }
                }
            },
            columns: [{
               title: "Name", field: "Name", template: "<a class='anchorNavLinkStyle' href='javascript:void(0)' data-ID='#= ID #' onclick='onChange(this)'>#=Name#</a>", width: 150
            },  {
                field: "Value",
                title: "Value",
                attributes: {
                     
                }
            }
            ]
        });
    }
    function onChange(arg) {
    var grid = $("#divCallLogHistory").data("kendoGrid");
    if (grid.select()) {
        var selectedItem = grid.dataItem(grid.select());
        if (selectedItem != null) {
            $('.k-animation-container').hide();
            $('.k-tooltip').hide();
            $('.modal-dialog').css({ top: 0, left: 0 });
            $('#divpopupwidth').addClass('popupmaxwidth');
            $('#divpopupcontent').html('');
            $('#popuptitle').html(' ');
            $('#divpopupcontent').load(appURL + "/Data/Details", {}, function () {
                GetProviderValidityDetails(selectedItem.ProviderID);
                SetProviderDetails(selectedItem.ProviderID);
                $('#spandummypopup').attr('data-target', '#divopenpopup');
                $('#spandummypopup').trigger('click'); 
            }); 
        } 
    }
}

 

This question does not have replies that have been liked.