angular-ui/ui-grid

cellNav click event fire issue without div element in a celltemplate

Open

#6067 aperta il 9 mar 2017

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)JavaScript (2496 fork)batch import
good first issue

Metriche repository

Star
 (5395 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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);

Guida contributor