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
No Data
Reply
  • 17590
    Offline posted

    Hello Agraj,

    Thank you for posting in our community.

    I believe the reason why the context menu appears behind grid is that the z-index of the menu is lower than the z-index of the grid container. Z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack trace. Some further reference could be found ta the following link:

    http://www.w3schools.com/cssref/pr_pos_z-index.asp

    In regards to the exception issue I will ned a running sample to debug on mi side in order to investigate this further and find the root cause of this behavior. Could you please isolate the issue in a small sample, removing all the code that is not directly related to this matter and send it back to me. This is going to be hihly appreciated and helpful.

    Please feel free to continue sending updates to this case at any time.

Children