:: Forum >>

Tracking Changes in the Grid

For an application I am developing in ColdFusion, I currently use the CFGrid Java Applet. I want to replace this applet with the ActiveWidgets Grid because it has greater functionality. The CFGrid applet tracks the changes made to each cell in each row in a hidden input object that can be parsed by the server when the form is submitted. What is the recommended method to track changes in the ActiveWidgets Grid and pass them to server-side scripts for database updates?
Carlo Bustamante
Wednesday, January 25, 2006
That is up to you. You can keep a duplicate array that has the initial values, and when you want to submit changes, do a compare of the initial grid to the data grid to see what changed and only send those rows back. It all depends on what you are doing on the server. Our app takes the entire array and does the compare on the server. This is changing for 2.0 as we are only sending back changes in that version.
You could also keep an array of rows that you know change. So every time someone makes a change, simply add that row to the array. Then to submit the changes, only send back those rows. That might be your cleanest solution.
Jim Hunter
Wednesday, January 25, 2006
"This is changing for 2.0 as we are only sending back changes in that version. You could also keep an array of rows that you know change. "

Jim,
A starter example would be very usefull for all new to this. For example,
What is the method of Knowing when a 'cell' or row item is changed?
A tiny example and or pointer to any Documentation on 2.0b4 would be great.
thanks so much
-g

And Yes, Carlos, replacing CFgrid in Cold Fusion with this wonderful tool, would make lilght years of improvement those applications that use the old CFgrid tool.
G. Cayman
Monday, January 30, 2006
Right now we have not written that code yet as Alex has not yet provided the event for data change but he says it is coming. I am banking on that event being in the final release. Once that event is there, you can attach code to the event that grabs the current row and adds it to the array. Then once you are going to send back the data you can send back the entire row contents or you can get real specific and create an array that stores the row and cell that got changed and only send back those pieces of information.
If you doa search of this forum you might be able to find where Alex referenced the new events. I think they are :

onCellChanged
onBeforeCellChanged

I am not possitive of the names but I think that is what he was talking about calling them.
Jim Hunter
Monday, January 30, 2006
There are two events which may help -

onCellTextChanged(text, col, row)

- this one allows to monitor changes inside the cell during editing, i.e. the event will fire after each character or delete/copy/paste operation.

onCellValidated(text, col, row)

- this one fires when the user pressed 'enter' key or leaves the cell.

Look at /examples/new/editing.htm for more details.
Alex (ActiveWidgets)
Monday, January 30, 2006
Thanks everyone for the help with this.
Carlo Bustamante
Wednesday, February 1, 2006

This topic is archived.


Back to support forum

Forum search