Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
500
Context menu selection error
posted

Hi Team,

I have created a grid in MVC controller using GridModel and passing the same to the view.

I have created a context menu, my requirement is to select multiple rows and right click (open context menu) and do certain operations like Export to Excel (selected rows), Copy selected rows, etc.

$(document).contextmenu({
selector: ".ui-iggrid-selectedcell.ui-state-active",
preventSelect: false,
menu: [
{ title: "Export to Excel", cmd: "exportToExcel" },
{ title: "Copy Selected Rows", cmd: "copySelectedRows" }
],

select: function (event, ui) {

  switch (ui.cmd) {

  case "exportToExcel":
  var selectedRows = $("#gridCategory").igGridSelection('selectedRow');

  //do something on selected rows

}

But I get the below error:

Uncaught Error: cannot call methods on igGridSelection prior to initialization; attempted to call method 'selectedRow' 

I have used a table as well instead of div as the grid container.

Also, the context menu appears behind the igGrid and not in front of the grid.

Please help me in resolving the issue.

Thank you.

Please let me know if you need any further details from me.

-Regards,

Agraj

Parents Reply Children