Forum


09:32

12/02/2009

I'm buiding an app where the selected item in the grid, when clicked, brings up a detail section (I hide the grid and show a div containing the detail). On this section, I'd like to be able to navigate forward and backward on the matching rows in the grid (while it is hidden) using navigation buttons in the detail section, and display in the visibile detail section the details of the newly selected row. Additionally, if I'm on the last row in the grid and the user clicks the navigate forward button on the detail section, I'd like to cause the grid to move to the next page. The idea is that if I then switch the display back to the grid, it will have the selected row corresponding to the row last displayed in the detail section.
03:02

Moderators
30/10/2007

Hello,
You can easy make a button for the next or prev record, but it is difficult to handle wher you are. You can maybe try form editing, scrollrows option and hide the grid when you are in edit mode - beforeShowForm event.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
00:17

12/02/2009

Thanks Tony. I think I solved the "what is the selected row in the grid" by getting the array of row ids and then finding the selected one in the list. I'm using this code now. I'm just wondering if there is an easier (buillt in way), or is this the way to go? (I'm not sure about the form editing option you suggested).
function NextDoc() {
var DocumentIds = $("#list").getDataIDs();
if (DocumentIds.length > 0) {
var selrow = $("#list").getGridParam("selrow");
var index = DocumentIds.indexOf(selrow);
if ((index >= 0) && (index < (DocumentIds.length - 1))) {
//Advance the row
var NewDocumentId = DocumentIds[++index];
$("#list").setSelection(NewDocumentId);
return;
}
//See if it is on the last row
if (index == (DocumentIds.length - 1)) {
//Advance the page
var page = $("#list").getGridParam("page");
page = page + 1;
$("#list").setGridParam({ "page": page });
$("#list").trigger("reloadGrid");
}
}
}
09:40

Moderators
30/10/2007

Hello,
Thanks for this. I think it is a very clear and simple way.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
36 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66