Next Button that moves master record

QuestionsNext Button that moves master record
Glenn asked 5 years ago

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.


4 Answers
Abu Ghufran answered 5 years ago

You can refer this link, and bind on some button click event.

var grid = $("#grid").jqGrid({…}); with your grid id,
var grid = $("#list1");

Abdullah answered 5 years ago

Abu, could you create example? Thanks.

Glenn answered 5 years ago

Thanks Abu,

Unfortunately I could not get it working.
To test it I also updated your master-detail.php demo with the below code.
The code below is the same as the stackoverflow except the list1 change.

<input type="button" value="Next" id="btnNext">

$('#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;
if (index > ids.length)
index = 1;
grid.setSelection(ids[index – 1], true);



Glenn answered 5 years ago

My bad.
I took another look right after I sent the email.
Changed the line like you said and it works like a charm.
var grid = $("#list1").jqGrid();

Thank You Abu!

Your Answer

2 + 16 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!