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
Hi Vasya,
Trying to increase the z-index was the first thing I did before even raising this request, changed it to 1000, than also the context menu was displaying at the back of grid.
Regarding the context menu click issue, everything which was related, I have mentioned in the issue. I have that js function, which results in the error as soon as I click it. You can take any simple hierarchical grid for this purpose.
Please let me know if you still need a running sample because I would be adding the same code in that application.
Thanking you in anticipation.
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.