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'
function filter_set($action){
$action->remove_field("id"); //the named field won't be included in CRUD operations
}
$grid->event->attach("beforeProcessing", filter_set);
To affect the default data processing either on the server- or client-side you should use either dataProcessor or dhtmlxConnector events. For more details, see the chapter 'Changing default processing' in 'Client-side requirement - dataProcessor'.
By using the set_status() method you can set status (custom or another predefined) of operation. 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
})
Calling the success() method you terminate any further action processing, i.e. data updating will be stopped and considered as finished.
function my_update($data){
...
$data->success(); // marks an operation as finished
}
$conn->event->attach("beforeUpdate","my_update")
To customize values before saving you should use the server-side events stated below:
function my_update($data){
...
}
$conn->event->attach("beforeUpdate","my_update")
For more information, see the 'Using server-side events' chapter in 'Making queries' guide.
The connector allows using transactions for INSERT/UPDATE/DELETE operations (make sure that the used DB engine has support for transactions).
To activate transaction mode use the set_transaction_mode() method. For more details see the chapter 'Transactions' in 'Making queries' guide.
$conn->sql->set_transaction_mode("global"); //for all records inside of single request
_or
$conn->sql->set_transaction_mode("record");// 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'.
dhtmlxConnector automatically executes CRUD operations for next patterns:
//to get data of a DB record
GET: connector.php?action=get&id={some}
//to delete data of a DB record
GET: connector.php?action=delete
//to update data of a DB record
GET: connector.php?action=delete
POST: id={some}&property_name={value}
//to insert a new record to DB
GET: connector.php?action=insert
POST: property_name={value}
For more details see the guide 'Saving data changes made in form'.
Back to top