I’m having a problem with my jQGrid. I’m trying to make it so that when the viewGridRow event triggers, to set the position of the popup window to the position of the cursor. I have a long list in the grid and defaults put the window at the top of the grid.
atm i have functions that retrieve the cursor position via jQuery:
var CursorX;
var CursorY;
$(document).bind('dblclick', function (e) { CursorX = e.pageX; })
$(document).bind('dblclick', function (e) { CursorY = e.pageY; })
and the configuration for the viewGridRow is as follows:
ondblClickRow: function (rowid) {
jQuery("#grid").jqGrid('viewGridRow', rowid, {
top: CursorY,
left: CursorX,
modal: true,
width: 1500,
caption: "View Item",
recreateForm: true,
beforeShowForm: function (form) {
jQuery("#grid").
setColProp('last_instruct', { formatter: "unformat" });
},
});
},
Problem is it doesn’t seem to work.
Anyone have an idea what i did wrong?
Just tested on one of my own grids and as wrote the problem is that the jQgrid is processing the ondblClick event before the variables are getting updated.
Do away with your binding of:
and just move to
you will also need to update your ondblClickRow to
Edit (to ensure the jQgrid is recreating a new view/edit, etc window each time.
Ex (Recreate a new edit form each time)
As a side note, you might want to think about what will happen when a user doubleclicks on an area that produces a form that will be outside the normal viewing area.