Forum
16:36
01/09/2008
All my grids are inline edits. My biggest challenge is detecting when the data in any one of the cells has changed which would indicate that I need to update the data on the server. Right now I have to use a combination of .getGridParam('savedRow') and .saveRow and then examine all the cell data passed in both records to see if anything has changed before I make a roundtrip to the server to update the data. If an event were triggered when the data in any one of the cells changed AND the format of the data in both saveRow and getGridParam('savedRow') were the same, it would be easier to manage inline editing changes.
Better would be an OnRowChange event that would pass a rowid and two objects: The before and the after row objects. That would make trapping changes easy! Seems to me most of that functionality is already there. Just need to raise the event and pass the extra object.
Thanks,
Pete
02:27
Moderators
30/10/2007
Hello,
This have sense. Not promiese if I will do something in 3.6 final for this.
Regards
Tony
P.S we should have a common solution for all editing modules.
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.
14:36
01/09/2008
Yes, I agree that a common solution would be great
The challenge has been the timing of "trapping" of the row change. I have been using the onSelectRow event to compare the row id's and retrieve the contents of the *last* selected row and update the database on the server. The code I call looks like this:
function saveGridRecord(gridName,lastRec,editURL){
var savedRowData;
// Theoretically the saved row data should be available, get it.
var mySavedRow = $(gridName).getGridParam('savedRow');
var rownumsaved = mySavedRow.length - 1;
if(rownumsaved >=0)
var rowData = mySavedRow[rownumsaved];
if(rowData)
savedRowData = rowToString(rowData);
$(gridName).saveRow(lastRec,saveRowCheck,editURL,{'extras':savedRowData});
}
The work is in formatting the data so it can be compared easily and right now I pass it to the server in the "extras" parameter to compare and *then* update the database if there is a change. If jqgrid already had the 'before' and 'after' data formatted the same then I could do a quick compare in javascript and only make the roundtrip to the server if it has changed. In fact, if the event raised was onRowChange, I wouldn't have to do the compare on the rows at all, jqGrid would do the compare and only raise the event if the data changed. That saves a great deal of work for me. If there is a change, raise the event with the before and after snapshots and then let me handle the details on what to do with the differences.
Thanks for thinking about doing this. It would be a great help and make my code much more efficient. I'll be happy to test, prototype, document or do whatever you need to make this happen.
Pete
Most Users Ever Online: 715
Currently Online:
83 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