简体   繁体   English

如何引用子网格Kendo-UI / AngularJS?

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

I want to reference to the object of my child grid and refresh the child grid with a new ID in the filter. 我想引用我的子网格的对象,并在过滤器中使用新的ID刷新子网格。 When I reference to the child grid of the Kendo-Grid I get an undefined object. 当我引用Kendo-Grid的子网格时,会得到一个未定义的对象。

HTML 的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 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"
                }
                ]
            }; 

You just need to add : $scope.detailGrid = "detailGrid"; 您只需要添加:$ scope.detailGrid =“ detailGrid”; in your Js file.. i think this will do the trick 在您的Js文件中..我认为这可以解决问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM