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

Row right click event for grid

Open Coralma opened this issue 11 years ago • 17 comments

Hi all, Did the ng-grid support row right click event? I want to add a popup context menu for each row. But the grid doesn't support the right click row selection. Any solution for this case?

Coralma avatar May 19 '15 10:05 Coralma

You can accomplish that using ng-context-menu (https://github.com/ianwalter/ng-context-menu) directive in your rowTemplate.

 rowTemplate: '<div>' +
                ' <div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader }"  ui-grid-cell context-menu data-target="myMenu"></div>' +
              '</div>',

<div class="dropdown position-fixed" id="myMenu">
    <ul class="dropdown-menu" role="menu">
      <li>
        <a class="pointer" role="menuitem" tabindex="1"
           ng-click="panel.highlight = true">
          Menu 1
        </a>
      </li>
      <li>
        <a class="pointer" role="menuitem" tabindex="2"
           ng-click="panel.highlight = false">
          Menu 2
        </a>
      </li>
      <li>
        <a class="pointer" role="menuitem" tabindex="3"
           ng-click="panel.highlight = false">
          Menu 3
        </a>
      </li>
    </ul>
  </div>

codesometech avatar May 19 '15 13:05 codesometech

Thanks @codesometech. It works !

Coralma avatar May 20 '15 09:05 Coralma

No its not working man !!! i am facing a problem as this TypeError: Cannot read property 'cellTemplate' of undefined at ngGridDirectives.directive.ngCell.compile.pre (http://angular-ui.github.io/ng-grid/lib/ng-grid.debug.js:3094:50) at j (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:42:195) at e (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:38:207) at j (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:42:255) at e (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:38:207) at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:37:339 at Object. (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:143:379) at Object.$get.e.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:84:286) at Object.$get.e.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:86:379) at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:15:396

Alhuck avatar Jun 10 '15 07:06 Alhuck

how can i pass row id to context menu?

yogi4yu avatar Oct 05 '15 05:10 yogi4yu

Thanks to @codesometech It works fine. The only matter is that I add the dropdown code in my parent dom instead of withing the rowTemplate.Or the position isn't right.

savokiss avatar Nov 12 '15 03:11 savokiss

Hi @codesometech, Where should I put the drop down code? If I put it in the index.html, then the menu is displayed as a list in the landing page.

rakshittonmoy avatar Nov 21 '15 16:11 rakshittonmoy

I'm also getting incorrect position when context-menu placed inside rowTemplate. @savokiss, @codesometech, how do you get the current row then?

eMazeika avatar Nov 26 '15 12:11 eMazeika

@eMazeika --did u get any succcess? If you have got a solution, please share with me ... Thanks in advance :)

rakshittonmoy avatar Nov 28 '15 17:11 rakshittonmoy

@tr3567, I've got this working: http://stackoverflow.com/a/34019441/1072921

eMazeika avatar Dec 01 '15 11:12 eMazeika

@eMazeika ---Can you please give me a link to your working code? Thank you :)

rakshittonmoy avatar Dec 09 '15 09:12 rakshittonmoy

@tr3567, we're using ui-grid in our e-commerce platform. Check Virto Commerce Manager: https://admin-demo.virtocommerce.com Login credentials: admin/store Navigate to: More -> Catalog

eMazeika avatar Dec 09 '15 10:12 eMazeika

@eMazeika ---Thank you so much... Bro you have created context-menu for each row... How do I do the same for each column header? I am new to ui-grid, so please forgive me for troubling you so much :P

rakshittonmoy avatar Dec 09 '15 12:12 rakshittonmoy

@tr3567 , there is menu out of the box for column header. If you insist for context menu, it should be very similar - override the default template.

eMazeika avatar Dec 09 '15 16:12 eMazeika

@eMazeika --how do I do that? Where exactly should I make the change?

rakshittonmoy avatar Dec 10 '15 06:12 rakshittonmoy

can you please post the entire code to display context menu on right click. I am completely new to ui-grid and angularjs

bpallavi avatar Mar 14 '18 10:03 bpallavi

I would also like to know entire code to display context menu on right click

On Wed, Mar 14, 2018 at 4:09 PM, bpallavi [email protected] wrote:

can you please post the entire code to display context menu on right click. I am completely new to ui-grid and angularjs

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular-ui/ui-grid/issues/3532#issuecomment-372976981, or mute the thread https://github.com/notifications/unsubscribe-auth/AKAEmOylE22zze6IvAyaWAS7u2S38rSnks5tePN3gaJpZM4EgG7_ .

--

Regards, Yogesh

yogi4yu avatar Mar 14 '18 11:03 yogi4yu

I would also like to know entire code to display context menu on right click

On Wed, Mar 14, 2018 at 4:09 PM, bpallavi [email protected] wrote:

can you please post the entire code to display context menu on right click. I am completely new to ui-grid and angularjs

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular-ui/ui-grid/issues/3532#issuecomment-372976981, or mute the thread https://github.com/notifications/unsubscribe-auth/AKAEmOylE22zze6IvAyaWAS7u2S38rSnks5tePN3gaJpZM4EgG7_ .

--

Regards, Yogesh

yogi4yu avatar Mar 14 '18 11:03 yogi4yu