未捕获ng-grid中此datepicker的缺失实例数据

时间:2014-09-08 09:47:19

标签: angularjs ng-grid

我正在尝试在ng-grid中获取datepicker我得到的错误类似于" Uncaught缺少此datepicker的实例数据Uncaught缺少此datepicker的实例数据"添加gridOptions后 enableCellEditOnFocus:true,我想突出显示单元格和编辑后的行

我有以下要求 1)如何访问ng-cell中最后编辑的单元格以应用css 2)如何将css类应用于最后编辑的行我的意思是类

.red{
   background:red;
   color:white; 
} 

特别是最后编辑的行我使用了行模板,虽然它在鼠标点击时工作正常但是没有工作"输入密钥编辑"在ng-grid中 请帮助我对仍在学习的角度js的新手

请参阅以下链接

var app = angular.module('myApp', ['ngGrid']);

app.directive("jqueryDatepicker",function(){
  return {
  link:function(scope,elm){
    angular.element(elm).datepicker();
   }
  }
});

app.controller('MyCtrl', function($scope) {
    $scope.myData = [{name: "Moroni", age: 50,dob:"1/08/1989"},
                     {name: "Tiancum", age: 43,dob:"1/07/1989"},
                     {name: "Jacob", age: 27,dob:"23/09/1988"},
                     {name: "Nephi", age: 29,dob:"26/09/1988"},
                     {name: "Enos", age: 34,dob:"05/05/1987"}];  
    $scope.gridOptions = { 
        data: 'myData',
        enableCellEdit:true,
        enableCellSelection:true,
        enableColumnResize:true,
        enablePinning:true,
        enableCellEditOnFocus:true,
        columnDefs: [
           {field:'dob', displayName:'DOB',pinned:true,
        cellTemplate:'<input jquery-Datepicker="" type="text" ng-model="row.entity.dob"/>'},
          {field: 'name', displayName: 'Name',pinnable:false}, 

        {field:'age', displayName:'Age',pinnable:false}
 ],
         beforeSelectionChange: function (rowItem, event) {
                                                $scope.rowItem=rowItem;
                                                $scope.rowId = rowItem.rowIndex;
                                                $scope.initialValue = clone($scope.myData[$scope.rowId]);              
                                          console.log($scope.initialValue)
                                                return true;
                                            },
    };
    function clone(obj) {
      if (obj == null || typeof (obj) != 'object')
          return obj;
      var temp = obj.constructor(); // changed

      for (var key in obj)
          temp[key] = clone(obj[key]);

      return temp;
      };
});

http://plnkr.co/edit/6h5JIJeCkARNGWQgzeJ9?p=preview

0 个答案:

没有答案