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
To remove some field from updating, you can use the following technique:
//write it before 'grid.render_table'
class CustomBehavior extends ConnectorBehavior{
@Override
public void beforeProcessing(DataAction data) {
data.remove_field("id"); //the named field won't be included in CRUD operations
}
}
grid.event.attach(new CustomBehavior());
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.
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
data.set_status("my_status");
//client side
dp.defineAction("my_status",function(sid,response){
...
return true;// return false to cancel default data processing at all
})
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{
@Override
public void beforeUpdate(DataAction data) {
...
data.success(); // marks operation as finished
}
}
component.event.attach(new CustomBehavior());
To customize values before saving, you should use the server-side events stated below:
class MyUpdate extends ConnectorBehavior{
@Override
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.
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
//or
conn.sql.set_transaction_mode(TransactionType.OPERATION);// for each record in request
To link dataProcessor with connector you should specify the connector file as a parameter of dataProcessor constructor:
dp = new dataProcessor("myconnector.php");
dp.init("mygrid");
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