使用自定义角度指令创建网格时,不会引发Kendo网格数据源更改事件 [英] Kendo grid datasource change event not raised when created grid using custom angular directive

查看:77
本文介绍了使用自定义角度指令创建网格时,不会引发Kendo网格数据源更改事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我创建了带有自定义角度指令的kendo网格,但它的数据源更改没有被提升,但是如果我使用没有自定义指令的代码它可以正常工作。

有人可以帮忙吗?



这里还有一个DOJO链接,这个问题可以重现:

按进度分类的KNondoUI®Dojo [ ^ ]



我尝试过:



Hi,
I created kendo grid with custom angular directive but it's datasource change not getting raised, however if i use the code without custom directive it works fine.
Can someone please help?

Also here is a DOJO link where this issue can be reproducible:
Kendo UI® Dojo by Progress[^]

What I have tried:

<div ng-app="kendoApp">
    <grid grid-name="stockGrid" grid-options="stockGridOptions"></grid>
</div>







<script>
    var app = angular.module('kendoApp', ["kendo.directives"]);

app.directive('grid', function () {
    return {
        restrict: "EA",
        scope: {
            gridName: "@",
            gridOptions: "@"
        },
        template: '<h1>kendoDirective</h1><br/><div kendo-grid={{gridName}} options={{gridOptions}}></div>',
        controller: function ($scope, $element, $attrs) {
            debugger;

            $scope.gridOptions = {
                toolbar: ["create", "save", "cancel"],
                dataSource: {
                    transport: {
                        create: {
                            url: "/Stock/InsertStockDetails",
                            type: "post",
                            complete: function (e) {
                                $scope.stockGrid.dataSource.data([]);
                                PopupSuccess(e.responseJSON.Message, 4000);
                            }
                        }
                    },
                    batch: true,
                    schema: {
                        model: {
                            id: "Id",
                            fields: {
                                Id: { type: "number", editable: false },
                                Product_Name: { type: "string" },                            
                                Strip_No: { type: "number", validation: { required: true } },
                                Strip_Unit: { type: "number", validation: { required: true } },
                                Total: { type: "number" },
                            }
                        }
                    },
                    change: function (e) {
                        debugger;                        
                    }
                },
                autoBind: false,
                columns: [{
                    field: "Product_Name",
                    title: "Product Name"
                },  {
                    field: "Strip_No",
                    title: "Number of Strip"
                }, {
                    field: "Strip_Unit",
                    title: "Units in Strip"
                }, {
                    field: "Total",
                    title: "Total"
                }],
                editable: true
            };

        },
        link: function ($scope, $element, $attrs) {
            debugger;
        }
    };
});
  </script>

推荐答案

范围,


元素,


attrs){
debugger;
attrs) { debugger;


这篇关于使用自定义角度指令创建网格时,不会引发Kendo网格数据源更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆