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: Get The Entire Data collection for Posting
07/03/2012
04:06
Avatar
Jose
Vancouver, British Columbia
Member
Members
Forum Posts: 5
Member Since:
07/03/2012
sp_UserOfflineSmall Offline

Hello Everyone,

PRE:  The grid contains several pages

PROBLEM:  

1. The user navigates throught the grid and edits values on different pages

2. The user clicks "Save" button expecting to save the changes

RESULT:

Only records on the current view are saved

Here are things that I have done:

var batch = new Array();

var dataIds = $('#results-grid').jqGrid('getDataIDs');

for (var i = 0; i < dataIds.length; i++) {

var data = $('#results-grid').jqGrid('getRowData', dataIds[i]);

batch.push(data);

}

Only the  current view records are retrieved.  Alternatively, I tried to hash the records by getting the getGridParam('records').  This does not work either because when I try to get the record outside of the scope of the current view, using a loop, the row is undefined (getRowData(i)).

Is there a way to get all the data from the grid?

Is there a way to manually paginate?

07/03/2012
04:28
Avatar
Jose
Vancouver, British Columbia
Member
Members
Forum Posts: 5
Member Since:
07/03/2012
sp_UserOfflineSmall Offline

If I use:

var gr = $('#results-grid').jqGrid('getRowData');  I only get the current view as well.  It was suggested that usining getRowData, without parameters would return the entire collection but this does not work for me.

Any idea?

07/03/2012
15:43
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

This method using this way do exactley waht you want.

You should make a diffrence between client side data (this is partial data)

and server side data (this can be the whole data)

Regards

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.

07/03/2012
18:14
Avatar
Jose
Vancouver, British Columbia
Member
Members
Forum Posts: 5
Member Since:
07/03/2012
sp_UserOfflineSmall Offline

Tony,

Thanks for your response.  I am doing a loadonce and paginate.

Do you think that I should be posting to the server on some sort of event handler when the user completes navigation to the next view?  The data is in memory already because the control loads it from page to page and when a change is made the clientArray gets is and it remembers if the user returns to that page.

Is there a way to acces "clientArray"?

Thanks

08/03/2012
03:59
Avatar
Jose
Vancouver, British Columbia
Member
Members
Forum Posts: 5
Member Since:
07/03/2012
sp_UserOfflineSmall Offline

Hello Tony,

Me again.  If I add a function to jqGrid like this then I have access to the entire collection.

getJosesData:



function () {



     return this[0].p.data;

},

then in my js file I call it like this:

var





d = $('#results-grid').jqGrid('getJosesData');

I could make it better and do it getting all ids then traverse the data...  but this is not desirable.  I understand your approach of doing the paging and updates on the server using the editUrl and posting.  I tried to negotiate with the BA but the requirement continues to be "save once in a batch when the user clicks Save".  This forces me to:

1.  do a loadonce

2. cellsubmit: clientArray

The control works great if I only need to display under my requirementes, but I need to save and that is my problem.

How does JQGrid support saving the way I have mentioned?

Best Regards

Jose

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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