DHTMLX Docs & Samples Explorer

Index
dhtmlxdataprocessor

## Data Sending Modes

a) Meaningfull names.
The parameters c0-cN, used by default, are not very useful on the server side. The dataprocessor allows to use the grid column IDs instead of them:

          grid.setHeader("Name of the book,Name of the author")
          grid.setColumnIds("book,author");
          ...
          dp.enableDataNames(true);

on the server side:
$_GET['c0'] ⇒ $_GET['book']
$_GET['c1'] ⇒ $_GET['author']

b) Using POST instead of GET.

          dp.setTransactionMode("POST")

c) Sending all at once.
By default the update for each row will be sent as a separate request. This means that when 20 rows are updated - 20 requests will be sent to the server. This is not the best approach, so instead of it a single (more complex) request can be sent to the server side:

          dp.setTransactionMode("POST",true)

In such mode the server side receives a slightly different set of parameters:
ids - a comma separated list of updated rows IDs, for each ID there will be set of details in the request.

For example if we have two updated rows on the client side with IDs = r2 and r3, the server side code will receive:
ids = r2,r3

- r2_!nativeeditor_status - the status of the operation for row r2;
- r2_c0 .. r2_cN - the data for a column of row r2;
- r3_!nativeeditor_status - the status of the operation for row r3;
- r3_c0 .. r3_cN - the data for a column of row r3.

The awaited server side response must be in the same format as usual, but must include the data for all processed rows:

          <data>
               <action type="some" sid="r2" tid="r2" />
               <action type="some" sid="r3" tid="r3" />
           </data>

Important! It's not recommended to set transaction mode if you use Connector. Connector requires using POST and sending all data at once. That corresponds to dp.setTransactionMode(“POST”,true). This mode is set by default in this case.

d) User can enable mode when only changed fields and row id send to the server side, instead of all fields in default mode

          dp.enablePartialDataSend(true);

e) Active fields.
There is possibility to define which column may trigger update:

          dp.setDataColumns([false,true,true,true]);

In that case changing first column values will not trigger data sending to the server. Such mode have sense only if auto update is enabled.