I use jqGrid 4.9.3-pre - free This example ok-soft-gmbh.com (Oleg):
But I put in my code line:
ondblClickRow: function (rowid) {
$(this).jqGrid("viewGridRow", rowid, { caption: "Details of the invice" });
}
The modal window with each new challenge is moving down. I found a line where changes:
if (!o.recreateForm) {
var formProp = $self.data("formProp");
console.log(formProp)
if (formProp) {
formProp.top = Math.max(formProp.top, 0);
formProp.left = Math.max(formProp.left, 0);
$.extend(o, formProp);
}
}
With each call a modal window increasing formProp.top
and formProp.left
.
How fix this problem?
For Oleg: Добрый день! Мне нужно вызывать viewGridRow и editGridRow кастомно. Тут по большей части только вы можете помочь. У меня при вызове модального окна, с каждым вызовом увеличиватся top and left.Пример своего кода не привожу. Но если нужно напишу.
Thank you for the bug report! I posted the bug fix just now. It modified the code of internal savePositionOnHide
function used for saving the previously position from
savePositionOnHide = function (propName, frmgr, h) {
var $w = h.w, $form = $(frmgr), $gbox = this.closest(".ui-jqgrid"), top, left;
if ($.contains($gbox[0], $w[0])) {
// we use below .style.height and .style.width to save correctly "auto" and "100%" values
// the "px" suffix will be saved too, but it's not a problem
top = getCssStyleOrFloat($w, "top");
left = getCssStyleOrFloat($w, "left");
} else {
top = $w.offset().top -
($gbox.offsetParent().offset().top +
$gbox.offset().top +
$gbox.position().top +
parseFloat($gbox.css("border-top-width") || 0));
left = $w.offset().left -
($gbox.offsetParent().offset().left +
$gbox.offset().left +
$gbox.position().left +
parseFloat($gbox.css("border-left-width") || 0));
}
this.data(propName, {
top: top, //parseFloat($w.css("top")),
left: left, //parseFloat($w.css("left")),
width: getCssStyleOrFloat($w, "width"), //$(h.w).width(),
height: getCssStyleOrFloat($w, "height"), //$(h.w).height(),
dataheight: getCssStyleOrFloat($form, "height") || "auto",
datawidth: getCssStyleOrFloat($form, "width") || "auto"
});
$w.remove();
if (h.o) { h.o.remove(); }
}
to
savePositionOnHide = function (propName, frmgr, h) {
var $w = h.w, $form = $(frmgr), $gbox = this.closest(".ui-jqgrid"),
getTopOrLeftRelativeToGbox = function (topOrLeft) {
return $w.offset()[topOrLeft] -
($gbox.offsetParent().offset()[topOrLeft] +
$gbox.offset()[topOrLeft] +
$gbox.position()[topOrLeft] +
parseFloat($gbox.css("border-" + topOrLeft + "-width") || 0));
};
this.data(propName, {
top: getTopOrLeftRelativeToGbox("top"),
left: getTopOrLeftRelativeToGbox("left"),
width: getCssStyleOrFloat($w, "width"),
height: getCssStyleOrFloat($w, "height"),
dataheight: getCssStyleOrFloat($form, "height") || "auto",
datawidth: getCssStyleOrFloat($form, "width") || "auto"
});
$w.remove();
if (h.o) { h.o.remove(); }
},
I hope that the problem is fixed in case of all combinations of the input parameters of form editing. At least the demo https://jsfiddle.net/OlegKi/tzp91wnf/ works now correctly.