3.2.0

Is it possible to submit Grid data after all edits are completed?

Hi,

I work for Indus International. We have finalized on ActiveWidgets Library for our Rendering Framework. I am sure someone for our IT will soon do a purchase order from you guys. Meanwhile I am doing a prototype with your grid.

I have seen your post on exposing the cell by cell edit events. But it is not very practical in enterprise class applications to do server side processing of cell edits. Lot of occasions where you have master detail kind of user interface where you have master data in the portion of the page that is outside of the grid and the detail is in the grid. In such scenarios you can't do anything with the cell data before the master data which is outside of the grid is saved.

So I am wondering if you can suggest a way to save the grid data along with the form data at the time of submitting the form.
Krishnan Muthuswamy
June 26,
Yes, saving data cell by cell is not practical in many cases - that was just the most simple example. In reality you would probably mark the modified rows (using the additional row property) in onCellValidated event. Then serialize the modified rows into some structure, put it into hidden textarea field before form submit or send the data using AW.HTTP.Request.

I am going to include something this in the future, including row-level editing events, however there are still several open questions, most important, what kind of serialization should be used to send back the modified rows? Microsoft has something called diffgram format (as far as I know), but what about Java, PHP? Any suggestion?
Alex (ActiveWidgets)
June 28,
Hi alex... maybe u can generate a new XML (based on XML SOURCE) with all rows values or with modified one, all plataforms can manipulate XML. (talking about GRIDS with AW.XML.Table).
Paulo Cesar Silva Reis (PC from Brazil).
June 28,
java will this help ?
http://diffxml.sourceforge.net/
I am not sure as to what diffgram actually does but this might be the equivalent in Java. However wont this constrain one in using only the XML as data?
Sandip
October 13,
Hi Krishnan,

I basically stick the values into a client side array when editing and then AJAX the array to a processing page when the update button is clicked or optionally if the user navigates away from the page without saving.
John Sourcer
October 13,
Hi all,
i'm using JSON for transport data... maybe will be useful.
Luca
January 11,
I'm looking for this as well. Batch updates of just the modified data. Single cell processing doesn't help in our application it must be batched due to size and processing time. Any examples?
Cal
March 26,
ActionScript in Flash has a robust DataGrid component with some kind of diff functionality, as I recall (it's been a few years). That may be an interesting look to see what strategies they came up with.
joe
March 27,
Here are some excerpts from the table object code attached to my grid that I use to do batch updates of modified data:

obj._updates = [];

   obj.on_cell_changed = function(text,col,row) {
      if (row > table._num_rows - 1) return;
      if (col > table._num_columns - 1) return;
      var decoded_text = html_entity_decode(text);
      table.get_row_data(row);
      if (decoded_text == table._row_data[col]) return;
      if (! table._updates[row]) table._updates[row] = [];
      table._updates[row][col] = decoded_text;
      if (table._on_cell_change) table._on_cell_change(decoded_text,col,row);
   }

   obj.process_updates = function(skip_current_check) {
      if (! skip_current_check) {
         var col = this._grid.getCurrentColumn();
         var row = this._grid.getCurrentRow();
         var text = this._grid.getCellText(col,row);
         this.get_row_data(row);
         if ((row < this._num_rows) && this._row_data) {
            var compare_text = html_entity_encode(this._row_data[col]);
            if (text != compare_text) this.on_cell_changed(text,col,row);
         }
      }

      if (this._updates.length > 0) {
         window.status = 'Saving Updates...';
         var request = new AW.HTTP.Request;
         request.setURL(this._url);
         request.setRequestMethod("POST");
         request.setAsync(false);
         request.setParameter("Command","UpdateRecord");
         request.setParameter("Table",this._table_name);
         var field_name;
         var field;
         var key_change_flag;
         for (var update_row in this._updates) {
            this.get_row_data(update_row);
            if (! this._row_data) continue;
            key_change_flag = false;
            for (field in this._field_names) {
               field_name = this._field_names[field];
               if (this._updates[update_row][field] != null) {
                  if (this._key_fields[field]) key_change_flag = true;
                  request.setParameter(field_name,this._updates[update_row][field]);
               }
               else request.setParameter(field_name,this._row_data[field]);
            }
            if (key_change_flag) request.setParameter("Command","AddRecord");
            request.request();
            if (request._http.status != 200) {
               alert('Unable to update table record: ' +
                     this.parse_value(request.getResponseText(),'message') +
                     ' ('+request._http.status+')');
            }
            if (key_change_flag) {
               request.setParameter("Command","DeleteRecord");
               for (field in this._field_names)
                  if (this._key_fields[field])
                     request.setParameter(this._field_names[field],
                                          this._row_data[field]);
               request.request();
               if (request._http.status != 200) {
                  alert('Unable to delete table record: ' +
                        this.parse_value(request.getResponseText(),'message') +
                        ' ('+request._http.status+')');
               }
               request.setParameter("Command","UpdateRecord");
            }
            for (field in this._field_names) {
               field_name = this._field_names[field];
               if (this._updates[update_row][field] != null)
                  this._row_data[field] = this._updates[update_row][field];
            }
            this.set_row_data();
         }
         this._updates = [];
         window.status = 'Done';
      }
   }
Randall Severy
March 28,
JSON is really good as well.
Sandip
April 11,

This topic is archived.

See also:


Back to support forum