ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Editable fixing

Open pro85 opened this issue 13 years ago • 3 comments

I set editableCellTemplate with select. To work correctrly need to comment code on line 3021 in ngCellHasFocus directive elm.bind('mousedown', function(){ //elm.focus(); return true; });

pro85 avatar May 13 '13 14:05 pro85

Yes, but instead of commenting the following may be a better idea:

elm.bind('mousedown', function(evt){
    if (evt.target.nodeName != "OPTION") {
        elm.focus();
    }
    return true;
});         

sayeed-anjum avatar May 15 '13 10:05 sayeed-anjum

In this style then need to if (evt.target.nodeName != "SELECT" && evt.target.nodeName != "OPTION")

pro85 avatar May 16 '13 12:05 pro85

So in 2.0.7, you are going to want this in a directive for your select:

       elm.bind('click', function(evt) {
            evt.stopPropagation();
        }); 

        elm.bind('mousedown', function(evt) {
            evt.stopPropagation();
        }); 

        scope.$on('ngGridEventStartCellEdit', function () {
            elm.focus();
        });

        angular.element(elm).bind('blur', function () {
            scope.$emit('ngGridEventEndCellEdit');
        });

You can look at the ngInput directive to see an example and also on the pull request to get an example of what to do: https://github.com/angular-ui/ng-grid/pull/511

jonricaurte avatar Jun 29 '13 04:06 jonricaurte