angular-ui/ui-grid

cellNav click event fire issue without div element in a celltemplate

Open

#6,067 建立於 2017年3月9日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)JavaScript (5,395 star) (2,496 fork)batch import
good first issue

描述

Hi team,

I am using cellTemplate with cellNav for navigation cell and try to edit the cell when clicking on the cell. However ,if there is no any div in template, the click event would not fire. I find in the source code below . The click event was bind to a div not the element itself. if there is no div element, how to fire "click" event. Or $elm.on('click'....) should be a right one. thanks.

src/features/cellnav/js/cellnav.js line 1070

          // When a cell is clicked, broadcast a cellNav event saying that this row+col combo is now focused
          $elm.find('div').on('click', function (evt) {
            uiGridCtrl.cellNav.broadcastCellNav(new GridRowColumn($scope.row, $scope.col), evt.ctrlKey || evt.metaKey, evt);

            evt.stopPropagation();
            $scope.$apply();
          });


          /*
           * XXX Hack for screen readers.
           * This allows the grid to focus using only the screen reader cursor.
           * Since the focus event doesn't include key press information we can't use it
           * as our primary source of the event.
           */
          $elm.on('mousedown', preventMouseDown);

貢獻者指南