javascript - ng-grid cell edit enables even disabled from code -
i have ng-grid dynamic columns. , data binding , other functions of grid working well. i'm having conditional statement in template display label or textbox according conditions .
the problem
in chorme.. label displaying correctly shown in below
but when double click cell goes cell editing mode below
in ie 11
the same thing happens label , textboxes when type goes cell edit mode , bounded events not firing textboxes. i've directives validations allow numbers etc .. things not working.
but in chrome, if don't double click cell textbox won't go cell edit mode , works well.
here code dynamically define grid columns.
function preparegridcolumns() { var dtlength = $scope.datelist.length; $scope.columndefinitions.length = 0; $scope.columndefinitions = [ { field: 'item', displayname: 'item', width: '25%' }, { field: 'suppliername', displayname: 'supplier', width: '15%' }, { field: 'total', displayname: 'total', width: '6%' }, { field: 'variance', displayname: 'variance', width: '6%' } ]; var colwidth = 0; if (dtlength > 0) colwidth = 50 / dtlength; //var cwidth = colwidth.tostring() + "%"; (var = 0; < dtlength; i++) { var newcol = { field: $scope.datelist[i].field, displayname: $scope.datelist[i].displayname, celltemplate: '<div class="ngcelltext" > <input type="text" ng-if="!controlgridcol(row.entity)" only-number decimal-upto="4" data-ng-model="row.entity.' + $scope.datelist[i].field + '" class="form-control input-lg" ng-keyup="calculateforward(row.entity,col.field,row.entity.' + $scope.datelist[i].field + ')" ng-disabled="controlgridcol(row.entity)" ng-readonly="controlgridcol(row.entity)">' + '<label ng-if="controlgridcol(row.entity)" data-ng-bind="row.entity.' + $scope.datelist[i].field + '"></label></div>', width: '60px', enablecelledit: true }; // '<div class="ngcelltext">{{row.getproperty(col.field)}}</div>' $scope.columndefinitions.push(newcol); } if (!$scope.$$phase) $scope.$apply(); };
here code grid
$scope.tgrid = { data: 'griddatalist', multiselect: false, enablecelledit: false, enablecolumnresize: true, enablecellselection: true, plugins: [new nggridflexibleheightplugin()], rowtemplate: '<div style="height: 100%" ng-class="colorrow(row.getproperty(\'variance\'))"><div ng-style="{ \'cursor\': row.cursor }" ng-repeat="col in renderedcolumns" ng-class="col.colindex()" class="ngcell ">' + '<div class="ngverticalbar" ng-style="{height: rowheight}" ng-class="{ ngverticalbarvisible: !$last }"> </div>' + '<div ng-cell></div>' + '</div></div>', columndefs: 'columndefinitions', //enablepaging: true, showfooter: true, rowheight: 40, footertemplate: "<div ng-show=\"showfooter\" class=\"ngfooterpanel\" ng-class=\"{'ui-widget-content': jqueryuitheme, 'ui-corner-bottom': jqueryuitheme}\" ng-style=\"footerstyle()\">" + " <div class=\"ngtotalselectcontainer\" >" + " <div class=\"ngfootertotalitems\" ng-class=\"{'ngnomultiselect': !multiselect}\" >" + " <span class=\"nglabel\">{{i18n.ngtotalitemslabel}} {{maxrows()}}</span><span ng-show=\"filtertext.length > 0\" class=\"nglabel\">({{i18n.ngshowingitemslabel}} {{totalfiltereditemslength()}})</span>" + " </div>" + " <div class=\"ngfooterselecteditems\" ng-show=\"multiselect\">" + " <span class=\"nglabel\">{{i18n.ngselecteditemslabel}} {{selecteditems.length}}</span>" + " </div>" + " </div>" + "</div>" };
the problem was.. i've mentioned enablecelledit: false
in grid declaration, i've set true in dynamic column generation.
var newcol = { field: $scope.datelist[i].field, displayname: $scope.datelist[i].displayname, celltemplate: '<div class="ngcelltext" > <input type="text" ng-if="!controlgridcol(row.entity)" only-number decimal-upto="4" data-ng-model="row.entity.' + $scope.datelist[i].field + '" class="form-control input-lg" ng-keyup="calculateforward(row.entity,col.field,row.entity.' + $scope.datelist[i].field + ')" ng-disabled="controlgridcol(row.entity)" ng-readonly="controlgridcol(row.entity)">' + '<label ng-if="controlgridcol(row.entity)" data-ng-bind="row.entity.' + $scope.datelist[i].field + '"></label></div>', width: '60px', enablecelledit: true // i've declared column // cell edit enabled };
actually mistake..
Comments
Post a Comment