如何在Angularjs ui-grid中添加jQuery日期选择器?

时间:2017-04-18 10:43:36

标签: jquery angularjs jquery-ui-datepicker ui-grid celltemplate

我一直在尝试使用自定义单元格模板在Jquery Datepicker UI网格中添加Angularjs

当我从date中选择Jquery date picker时,UI-Grid完成加载后,JQuery date picker功能对于相应的单元格不起作用。

我试图强行删除自定义目录中的DOM元素,但没有运气。

$scope.editableCellTemplateFrom = '<div ui-grid-editor><form name="inputForm" ><input type="text"  readonly  data-ng-model="row.entity.validFrom" extdatepicker /></form></div>' ;


customdirectives.directive('extdatepicker', function (uiGridConstants,$timeout) {
    return{
    restrict: 'A',          
    link: function(scope, element, attrs, Ctrl) {

    element.datepicker({
    dateFormat: 'dd/mm/yy', 
    changeMonth: true, 
    changeYear: true,
    onSelect: function(d,i){
    $timeout(function(){
    scope.row.isDirty = true;
    scope.row.entity.validFrom = d;
    element.parent().parent().removeAttr("aria-selected");
    element.parent().parent().find('div').removeClass("ui-grid-cell-contents-hidden ui-grid-cell-focus");
    element.parent().remove();
    //scope.row.grid.api.rowEdit.setRowsDirty([scope.row.entity]);
    if (!scope.row.grid.api.rowEdit.dirtyRows ){
    scope.row.grid.api.rowEdit.dirtyRows = [];
    }
    scope.row.grid.api.rowEdit.dirtyRows.push(scope.row.entity);
    //scope.row.grid.api.edit.raise.afterCellEdit(scope.row.entity, scope.col.colDef);
    scope.row.grid.api.edit.raise.cancelCellEdit(scope.row.entity, scope.col.colDef);

    //scope.row.grid.api.edit.raise.cancelCellEdit(scope.row.entity, scope.col.colDef);
    //scope.row.grid.api.core.notifyDataChange(uiGridConstants.dataChange.EDIT);

    //scope.row.grid.api.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
    scope.row.grid.api.core.raise.columnVisibilityChanged( scope.col);

    scope.$apply();

    scope.row.grid.api.core.refresh();
    //endEdit
    },1000);
    }
    });  

    }            
    }
    });

ui-gridJQuery date pciker加载了cell-grid后,如何启用/刷新v1.2.3功能。

使用的版本是有角度的ui-grid v3.0.6UPDATE table1, table2 SET table1.col = a, table2.col2 = b WHERE table1.id = table2 .id;

0 个答案:

没有答案