I'm having trouble with editable jqGrid's behavior when jqGrid becomes long. Clicking on non-editable cells and submitting edited cells brings the user to the top of the grid. Randomly clicking around would produce tons of unpredictable results. The element that gets focused is set to "top:-1000000px". What would be a good resoultion for this? Is there a way to override the focus
event on this element?
<script type="text/javascript">
function populateTable(table) {
for(i = 0; i < 1000; i++) {
table.addRowData(i, {key:'Lorem', value:'Ipsum'});
}
}
$(document).ready(function() {
$("#grid").jqGrid({
datatype : "local",
colNames : ["Key", "Value"],
colModel: [
{name:'key', index:'lever', width:500, editable: true},
{name:'value', index:'defaultcpm', width: 100, editable: true},
],
height: 'auto',
cellEdit: true,
cellSubmit: 'clientArray'
});
populateTable($("#grid"));
});
</script>
</head>
<body>
<table id="grid"></table>
</html>
Edit: I suppose I was not specific enough. I do not want focus change after edits. The following code fixes it, but has side effects if any non-grid HTMLDivElement
receives a focus event.
HTMLDivElement.prototype.focus = function() {}