Hi
Looking for a way to click a button and have the master record move to the next record.
By moving to the next record it would then update all the detail records automatically.
Thanks
Glenn
You can refer this link, and bind on some button click event.
http://stackoverflow.com/a/7298901/385377
Replace:
var grid = $("#grid").jqGrid({…}); with your grid id,
e.g.
var grid = $("#list1");
Thanks Abu,
Unfortunately I could not get it working.
To test it I also updated your master-detail.php demo with the below code.
http://websalesdesign.com/proj/lib/phpgrid-full/index.php
The code below is the same as the stackoverflow except the list1 change.
<input type="button" value="Next" id="btnNext">
<script>
$('#btnNext').click(function () {
var grid = $("#list1").jqGrid({…});
var selectedRow = grid.getGridParam('selrow');
if (selectedRow == null) return;
var ids = grid.getDataIDs();
var index = grid.getInd(selectedRow);
if (ids.length < 2) return;
index++;
if (index > ids.length)
index = 1;
grid.setSelection(ids[index – 1], true);
});
</script>
Regards,
Glenn