简体   繁体   English

编辑内联模式下的Kendo Ui Grid禁用按钮

[英]Kendo Ui Grid disable button when in edit inline mode

I have a kendo grid with create, edit and delete buttons. 我有一个带有创建,编辑和删除按钮的kendo网格。 I also have a next button outside the grid. 我在网格外部还有一个下一个按钮。 What I want to do is prevent the user from clicking on the next button, if the user doesn't at least create/edit one record first. 我想做的是,如果用户至少没有首先创建/编辑一个记录,则阻止用户单击下一个按钮。

<div ng-show="showActivePage === 'PageTwo'" ng-controller="inputFiscalYearController" >
    <div kendo-grid="myGrid"   k-options="gridOptionsFiscalYear" ></div> 

    <div ng-click="showActivePage = 'PageThree'"> Next </div>
    <div ng-click="showActivePage = 'PageOne'"> Back </div>
</div>


app.controller('inputFiscalYearController', ['$scope', function ($scope) {
$scope.isDisabled = false;
$scope.gridOptionsFiscalYear = {
    toolbar: ["create"],
     editable: true,
     pageable: true,
     edit: function(){
         alert();

     },

     columns: [
             {
                 field: "Name",
                 title: "Name",
                 width: "250px",
             },
             {
                 field: "Surname",
                 title: "Surname",
                 width: "250px",

             },
              {
                  title: "",
                  command: ["edit", "destroy"],
                  width: "105px"
              },
    ],
    editable: "inline",

    dataSource: {
        data: [

        ],
        pageSize: 10,
        schema: {
            model: {
                id: "id",
                fields: {
                    id: { editable: false },

                    Name: {
                        type: "string",
                        validation: {
                            required: {
                                message: "*Required"
                            }
                        }
                    },
                    Surname: {
                        type: "string",
                        validation: {
                            required: {
                                message: "*Required"
                            }
                        }
                    },
                }
            }
        }
    },
}
}]);

I'm not familiar with kendo-ui, but I do know Angular. 我不熟悉kendo-ui,但我确实知道Angular。 Couldn't you just do: 你不能只是做:

<div ng-click="showActivePage = 'PageThree'" disabled="!gridOptionsFiscalYear.data.length"> Next </div>

I'm presuming that gridOptionsFiscalYear.data is where new records will be created. 我假设使用gridOptionsFiscalYear.data创建新记录。

Edit: didn't have the required negation on the length. 编辑:长度上没有要求的取反。

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

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