Check documentation for the latest version of dhtmlxSuite Data Updating HowTos DHTMLX Docs

Data Updating HowTos

How can I alter the default styles set for responses?

You can alter the default styles for each state, like:

dp.styles.error = ""; //avoids a special style for the 'error' response
//you should write it on the client side (in your HTML file)
//dp - dataProcessor object

How can I avoid updating certain field(s)?

To remove some field from updating, you can use the following technique:

//write it before 'grid.render_table'
class CustomBehavior extends ConnectorBehavior{
    public void beforeProcessing(DataAction data) {
        data.remove_field("id"); //the named field won't be included in CRUD operations
grid.event.attach(new CustomBehavior());

How can I change default data processing while updating?

To affect the default data processing either on the server side or on the client side you should use either the events of dataProcessor or dhtmlxConnector. For more details, see the chapter 'changing default precessing' in the 'Client-side requirement - dataProcessor' chapter.

How can I set a custom status of the operation?

To set the status (custom or another predefined) of operation use the set_status() method.
By means of using the defineAction() method of dataProcessor you can assign the appropriate processing for this status.

//server side
//client side
return true;// return false to cancel default data processing at all

How can I terminate any further processing?

By calling the success() method you terminate any further action processing, i.e. data updating will be stopped and considered as finished.

class CustomBehavior extends ConnectorBehavior{
    public void beforeUpdate(DataAction data) {
        data.success(); // marks operation as finished 
component.event.attach(new CustomBehavior());

How can I change values before saving?

To customize values before saving, you should use the server-side events stated below:

class MyUpdate extends ConnectorBehavior{
    public void beforeUpdate(DataAction data) {
component.event.attach(new MyUpdate());

For more information, see the 'Using server-side events' chapter in the 'Making queries' guide.

How can I implement transactions?

The connector allows using transactions for INSERT/UPDATE/DELETE operations (be sure that used DB engine has support for transactions ).

To activate the transaction mode - use the set_transaction_mode() method. For more details see the chapter 'Transactions' in 'Making queries' guide.

conn.sql.set_transaction_mode(TransactionType.GLOBAL); //for all records in one request
conn.sql.set_transaction_mode(TransactionType.OPERATION);// for each record in request

How can I link dataProcessor with connector?

To link dataProcessor with connector you should specify the connector file as a parameter of dataProcessor constructor:

dp = new dataProcessor("myconnector.php");

How can I update data on the server side?

To update data on the server side, you should initialize dataProcessor on the client side and link dhtmlxConnector to it. The default updating will be done automatically. For more details, see the guide 'Client-side requirement - dataProcessor'.

Back to top