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
OnRowChange event
24/10/2009
16:36
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

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

27/10/2009
02:27
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

27/10/2009
14:36
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

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

25/02/2010
19:22
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

STILL hoping to see this in a future release (still waiting)!

Forum Timezone: Europe/Sofia

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

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information