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
jqGrid getData only returns data for current page
22/07/2010
12:12
Avatar
jqwha
Member
Members
Forum Posts: 18
Member Since:
07/07/2010
sp_UserOfflineSmall Offline

Hi,
Hopefully this is a quick one!

I have an editable grid using 'clientSide' (local) data and I now wish to iterate all the rows in javascript and process/package the data myself before sending it to the server via a jQuery.ajax call.

The problem is that, unexpectedly (for me at least), using the following code only retrieves the rows for the currently visible grid page! How can I get ALL the rows in the grid (i.e. I have four pages of 10 records each and this code only returns the first 10 when I'm on page 1)? They must be present in the client somewhere because I can page around and edit the rows and the data is persisted without calling the server! :)

        cacheCONF = [];
        var rows= $('#myGrid').getRowData();  //<–Need to get ALL rows here!!!
        var cacheRowID = 0;
        for (var row in rows) {
            if (rows[row].Action == 'Yes') {
                cacheCONF.push({ RowID: rowID, System: rows[row].System, Action: rows[row].Action, Account: '-', Required: '-'  });
                rowID++;
            }
        }

Thanks!

22/07/2010
12:47
Avatar
jqwha
Member
Members
Forum Posts: 18
Member Since:
07/07/2010
sp_UserOfflineSmall Offline

Found a workaround by temporarily changing the page size. Hope there's a more "formal" solution.

Code is:

var pageSize = $('#myGrid').getGridParam('rowNum');

$('#myGrid').setGridParam({ rowNum: 10000 }).trigger("reloadGrid");

getRowData will then get up to 10000 rows (so set it higher than your max possible rows).

You can then use pageSize to set the page size back to the user's preference.

22/07/2010
15:21
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

If you are in local mode it is just simple

var mydata = $("#grid").jqGrid('getGridParam','data');

will give you all your data.

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.

22/07/2010
16:18
Avatar
jqwha
Member
Members
Forum Posts: 18
Member Since:
07/07/2010
sp_UserOfflineSmall Offline

Awesome. Thanks. Never thought of that!

27/05/2011
11:20
Avatar
rixxie
Member
Members
Forum Posts: 4
Member Since:
27/05/2011
sp_UserOfflineSmall Offline

I'd like to do the same but it doesn't work with loadonce enabled on jqGrid 3.8.2.

Is there anyway to accomplish this ?

27/05/2011
11:30
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

It do work with loadonce:true, but you should take in the consideration when you should call the $("#grid").jqGrid('getGridParam','data'). You can do this after the data are loaded from the server. So you can do this for example inside of loadComplete event handler.

Regards
Oleg 

27/05/2011
11:37
Avatar
rixxie
Member
Members
Forum Posts: 4
Member Since:
27/05/2011
sp_UserOfflineSmall Offline

That was fast OlegK, thanks but I've found the solution at http://stackoverflow.com/quest.....-same-time

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
50 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