Forum


15:15

01/09/2008

I'd like to detect when a row's contents have changed so that I only have to make the round trip to the server when the actual data has changed. Right now I have my code conditioned on onSelectRow but of course it will show me what the row contents on a prior row was (if I save them) and it will show me what the currently selected row is. What I *want* is to compare the "before" and "after" values of the data on the same row. Something conditioned on an "onLeave" or "on blur" event to capture the record after it has been changed.
Has anyone done something like this? A nice enhancement would be to have an "onRowChange" event to fire when the contents have actually changed.
Ideas?
Thanks!
02:30

Moderators
30/10/2007

Hello,
There is a option savedRow, which save the row before editing. See options in grid.
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.
17:06

01/09/2008

Thanks Tony. I can see the property but it doesn't appear to have a value. I am using 3.4 of jqGrid. Do you have an example of how to use this property? In my case, I used it like this:
olddata = $('#myGrid').savedRow;
But there is no value in the property. How/when does this get populated?
I create the grid, populating the grid from the DB. Then, using inline editing, I would like to add some code to the onSelectRow function that basically compares the row as it was before the row was selected and the current value and, if there is a difference, THEN save it. I don't want/need to save the row if it hasn't changed. I am trying to detect that change.
If this is a 3.5 feature, let me know and I'll try it but it would also be helpful to see and example of how I would implement it.
10:10

Moderators
30/10/2007

Hello,
This is created for you automatically.
After editing the row - you can
var savedrow = $("#mygrid").getGridParam('savedRow');
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.
21:11

01/09/2008

One more issue. It looks like the $(”#mygrid”).getGridParam('savedRow') method is returning an array of multiple rows. Every time you save a row the savedRow parameter contains an additional rows information. Is that the intended behavior? If so, perhaps you should rename the parameter to savedRows (plural) which would more accurately indicate that the parameter contains ALL saved rows, rather than the row *just* saved, which is what I would have expected.
Also, I want to pass the saved row to my server function as a parameter. I know that the current row's data is passed as a parameter in the saveRow function but how would I change the savedRow parameter to a string that could be passed to the server? I grab the last row in the savedRow array like this:
var mySavedRow = $('#subQual').getGridParam('savedRow');
var rownumsaved = mySavedRow.length - 1;
if(rownumsaved >=0)
var rowData = mySavedRow[rownumsaved];
but toString and JSON.stringify n the variable rowData return invalid results. It appears to be an array but I can't quite coerece it into a string.
Ideas?
00:42

Moderators
30/10/2007

Hello,
You are right, but I think it is too late to change the name.
Do not know why this can not be converted. Check what you have in rowData
also you can do this
console.log(rowData);
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.
09:45

01/09/2008

The wierdness is that Firebug shows that rowData looks like an array of values. rowData displays like so in Firebug:
- rowData
certified=""
criteria1="TEACH"
criteria2="ANY"
criteria3="RHS"
criteria4=""
criteria5=""
gradeMax="12"
gradeMin="09"
id="3"
preferredSeq=""
These are the values from the row that was saved so that IS correct, yet console.log(rowData) returns [ ] (empty array).
I'll experiment some more but if I can get this cast to a string, I can finish up this app.
Thanks
10:18

Moderators
30/10/2007

Hello,
Yes it is a bug - Fixed in GitHub. Could you please let me known if all work OK.
Thanks
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:
69 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