I would like to position the view form of a jqgrid to the center of a screen. Because the height is set automatically (depending on the amount of data), I need to calculate its center position after it is rendered. Hence I would like to use the afterShowForm. Unfortunality, it's not being called whatsoever. I tried older versions of jqGrid (maybe the newest one contains a bug), but it didn't solve my problem. Anyone got a clue why it's not firing? Please note that when I change 'afterShowForm' in 'beforeShowForm' it does get fired. But then the height is not calculated yet. Thanks! (of course you are more than welcome to suggest another way to achieve my goal!). Code:
$("#grid").jqGrid("navGrid", "#pager",
{ view: true, addfunc: additem, editfunc: edititem, delfunc: deleteitem },
{},
{},
{},
{},
{ width: 350,
afterShowForm: function (formid) {
alert('yey');
// Here I want to center the form
}
}
);
Edit: On the wiki I found out that the View form doesn't have a afterShowForm event; it only has onClose and beforeShowForm :( so I guess it's not possible to set the position to the center this way..