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

How to reference to the child grid Kendo-UI / AngularJS?

1 Answer 170 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Дмитрий
Top achievements
Rank 1
Дмитрий asked on 04 Aug 2016, 02:05 PM

I want to reference to the object of my child grid and refresh the child grid with a new ID in the filter. When I reference to the child grid of the Kendo-Grid I get an undefined object.
HTML

<div kendo-grid="customerGrid" k-rebind="mainGridOptions" options="mainGridOptions" k-on-filter-menu-init="filterInit(kendoEvent)">
            <div k-detail-template>
                <div id="tabstrip" kendo-tab-strip="tabstrip">    
                    <ul>
                        <li class="k-state-active">СЧЕТА КЛИЕНТА</li>
                        <li ng-disabled="dis" ng-click="loadDetailAcc()">Полная информация по счету</li>
                        <li ng-disabled="dis" ng-click="loadDetailGrid()">Просмотр событий по счету</li>
                    </ul>
                    <div>
                        <div>
                            <div kendo-grid="detailGrid" k-options="detailGridOptios"></div>
                        </div>

JAVASCRIPT/ANGULARJS

$scope.loadDetailGrid = function () {    
    console.log($scope.detailGrid);// undefined
    $scope.detailGrid.dataSource.read(); //error
};
 
             $scope.detailGridOptios = {
                dataSource: {
                    transport: {
                        read: '/api/HomeApi/GetAccountEvent',
                        dataType: "json"
                    },
                    pageSize: 3,
                    filter: { field: "UniqueAccontCode", operator: "eq", value: id }
                },
                autoBind: false,
                height: 180,
                pageable: true,
                columns: [
                {
                    field: "IDUser",
                    title: "Идентификатор пользователя",
                    width: "120px"
                },
                {
                    field: "UniqueAccontCode",
                    title: "Номер счета",
                    width: "120px"
                }, {
                    field: "LastActData",
                    title: "Дата последнего действия",
                    width: "120px"
                }, {
                    field: "Text",
                    title: "Текст",
                    width: "120px"
                }
                ]
            };

 

 

 

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 08 Aug 2016, 11:29 AM

Hello Дмитрий,

Theoretically such approach for accessing the child grid will not work, because same variable ($scope.detailGrid in this case) will point to all child grid instances. My suggestion is to find the DOM element and get a reference to the widget. 

Regards,
Boyan Dimitrov
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Дмитрий
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or