DHTMLX Docs & Samples Explorer

Custom Server Side Responses

The dataprocessor has 5 predefined modes of response:

  • update;
  • insert;
  • delete;
  • invalid;
  • error.

But in some cases you will need a way to return some additional information (the most common use-case - an error during a DB operation). In such case you can introduce an additional response type:

      dp.defineAction("my_error",my_action)

Where my_action - a custom function, which will be called when the response of “my_error” type is received.

  <data>
       <action type="my_error" sid="id" tid="id">Details</action>
  </data>
 
  function my_action(node){
      alert(node.getAttribute("type"));    // my_error
      alert(node.firstChild.data);    // Details
      return false;
  }