0 Replies Latest reply on Oct 7, 2009 10:17 AM by kenji776

    CFGRID Losing data in row when you click it

    kenji776 Level 1

      Hey guys,

      I have a CFgrid that I am populating with flash remoting. The user can interact with it, make some changes, and then I want to pass the entire grid to a CFC via flash remoting to save all the info back into the database. This works just fine, unless you actually click a row on the grid, then for some reason there is a hole in the passed array where that row was. For example, say the grid loads and has 6 rows in it. Don't click any of them, and then call my save function. The save function passes the grid as an array of structures to my CFC component. 1 array element for every row in the grid, and each structure contains the name of every field passed. Everything work fine.

       

      Then, load the same grid, but this time click a row, any row, and try to save. The array it passes will have an [undefined array element] where the information for that row should be. The onclick currently has no functions or handlers bound to it (previously it did have a function to save just that one row that you clicked, but it is currently removed for testing sake). I have no idea why. Click a row removes it from the grid. I remember running across this once before but have no idea how/if I fixed it.

       

                function saveAllLocal()
                {
                   & nbsp; var connection:mx.remoting.Connection =
                   & nbsp; mx.remoting.NetServices.createGatewayConnection(
                   & nbsp; "http://portal.fpitesters.com/flashservices/gateway/");
                   & nbsp;
                   & nbsp; var myService:mx.remoting.NetServiceProxy;
                   & nbsp;
                   & nbsp; var responseHandler = {};

                   & nbsp; Statusbox.text = "<img src='http://images.fpitesters.com/portal/icons/script_edit.jpg' width='16' height='16' hspace='0' vspace='0'> Saving Records Locally";
                   & nbsp;

                   & nbsp;
                   & nbsp; //put the controls in scope to avoid calling _root
                   & nbsp; var StudyList = StudyList;
                   & nbsp;
                   & nbsp;
                   & nbsp;
                   & nbsp; responseHandler.onResult = function( results: Object ):Void
                   & nbsp; {
                   & nbsp;      //when results are back, inform the user.
                   & nbsp;      _root.Statusbox.text = "<img src='http://images.fpitesters.com/portal/icons/done.jpg' width='16' height='16' hspace='0' vspace='0'> "+results.toString();
                   & nbsp;     
                   & nbsp; }
                   & nbsp;
                   & nbsp; responseHandler.onStatus = function( stat: Object ):Void
                   & nbsp; {         
                   & nbsp;      Alert.show(stat.description.toString(), 'Upgrades', Alert.OK, this, placeHolder, "stockIcon", Alert.OK);
                   & nbsp;      _root.Statusbox.text = "<img src='http://images.fpitesters.com/portal/icons/error.jpg' width='16' height='16' hspace='0' vspace='0'> Error: "+stat.description.toString();
                   & nbsp;     
                   & nbsp; }
                   & nbsp;     
                   & nbsp; myService = connection.getService("<cfoutput>#ComponentName#</cfoutput>", responseHandler );
                   & nbsp;
                   & nbsp; myService.SaveGrid(RespondentList.dataProvider.slice(0));     
                }

       

      RespondentList is the name of my grid. If anyone has any idea why this is happening, or even a hunch, please let me know, as I am completly stumped.

       

      Just to clarify, the data doesn't disappear from the grid itself visually when you click a row, just when the data is passed to my CFC there is a "hole" in the array where any record you clicked on was.