FastTrack
FastTrack

Reputation: 8980

jQGrid Select/Highlight Newly-Added Row

Using jQGrid, I would like a newly-added record (row) to be highlighted (or selected) after a successful insert. Basically, I just want the user to easily see the new record in the grid right after they add it.

Any ideas? Thanks!

Upvotes: 0

Views: 345

Answers (1)

Mark
Mark

Reputation: 3123

You could save the ID value of the row as part of your Add function, then after the submit and reload you could iterate over the grid searching for that saved value and when found set it to the selected row.

The issue I see though is based on where your row is going to be positioned in the grid after it is added. Ex you have a grid with 5 pages and your added record would naturally filter to page 3 and you were on page one.

You could do some fancy server side logic to return the page containing your new record to ensure the above function was always able to find the added record as well if you wanted.

Upvotes: 1

Related Questions