0

So I have created a context box upon right click that has Add/Edit/Delete Rows. I also have a bunch of code launched before the Dialog is shown. My problem is that when I use the context menu it doesn't go through some of the code. I have tried to call on the functions directly but it doesn't format correctly.

I am mainly concerned with the edit button, here is the code I am using to bring up the edit Dialog

 function editRow() {
     var grid = jQuery("#<%= Jqgrid1.ClientID %>");
     var rowKey = grid.getGridParam("selrow");
     if (rowKey) {
         // I have tried calling functions here and it still doesn't work
         grid.editGridRow(rowKey, grid.editDialogOptions);
     }
     else {
         alert("No rows are selected");
     }
 }

So if I use this to display the editform it isn't formatted correctly nor does it go through the functions all correctly.

I am using the ASP Webforms version of Jqgrid so I call the function by doing this

<cc1:JQGrid1 ID="Jqgrid1
 //other attributes

ClientSideEvents-BeforeEditDialogShown="ChangeMonitor" 

 //Rest of code />

So this works just fine, and I'm trying to get the Edit button on the context menu to display correctly.

My thought was to use Jquery to trigger a click on the actual Edit button once someone used the context menu. I couldn't find an ID that would work however.

Is there an easy way to connect my context menu Edit button, with the actual Edit button in the toolbar?

4

1 に答える 1

0

Well I found a solution to my problem.

The id field of the button was edit_ct100_cpMainContent_Jqgrid1_top so I just triggered a click with this code.

$("td[id^=edit][id$=top]").trigger("click")

For some reason when I used the _ct100_cpMainContent_Jqgrid1 it wasn't working, but now it does. Hope this helps someone.

于 2012-05-25T19:34:07.177 に答える