Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Controlling grid pagination and selection from non-grid controls
19/02/2009
09:32
Avatar
hpinsley
Member
Members
Forum Posts: 3
Member Since:
12/02/2009
sp_UserOfflineSmall Offline

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.

20/02/2009
03:02
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

23/02/2009
00:17
Avatar
hpinsley
Member
Members
Forum Posts: 3
Member Since:
12/02/2009
sp_UserOfflineSmall Offline

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");
        }
    }
}

23/02/2009
09:40
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information