But it is not that i want. I insert wrong data but “onAfterupdate” event return “inserted” by tag.getAttribute(“type”) and return “null” by tag.getAttribute(“sync”). But the same response i received when insert correct data.
in this article http://docs.dhtmlx.com/doku.php?id=dhtmlxdataprocessor:commontask i read
What i must do on server-side to return this message if something wrong?
In case of connector it will be call to $action->invalid(); in some of server side events. Normally if DB level error occurs - connector will return “error” status automatically ( invalid status is not set automatically, and can be set through custom events only )
In case of custom code you need to return xml with type=“invalid”, the decision when to output it - is specific to custom server side code.
Stanislav, this is my server-side code
[code]<?php
ini_set(‘display_errors’,1);
error_reporting(E_ALL);
header('Content-Type: text/xml; charset=windows-1251');
require("../dhtmlxConnector/php/codebase/grid_connector.php");
require("../dhtmlxConnector/php/codebase/db_mssql.php");
require_once("../config.php");
$conn= mssql_connect('','','');
mssql_select_db('');
$sql_query = "SELECT ... ";
if ($condition <> NULL) {
$sql_query = iconv('UTF-8','cp1251',$sql_query.$_GET['condition']);
}
$datagrid = new GridConnector($conn,"MsSQL");
$datagrid->enable_log("data_log.txt");
function formatting($row){
$data = $row->get_value("Datetime_Enbl");
if (!is_null($data)) $row->set_value("Datetime_Enbl",date("d.m.Y H:i:s",strtotime($data)));
$data = $row->get_value("Datetime_Dsbl");
if (!is_null($data)) $row->set_value("Datetime_Dsbl",date("d.m.Y H:i:s",strtotime($data)));
}
function formatting2($row){
$data = $row->get_value('Datetime_Enbl');
$data = strtotime($data);
if ($data <> NULL) {
$data = date("Y-m-d H:i:s", $data);
$row->set_value("Datetime_Enbl",$data);
}
else $row->set_value("Datetime_Enbl",NULL);
$data = $row->get_value('Datetime_Dsbl');
$data = strtotime($data);
if ($data <> NULL) {
$data = date("Y-m-d H:i:s", $data);
$row->set_value("Datetime_Dsbl",$data);
}
else $row->set_value("Datetime_Dsbl",NULL);
$data = $row->get_value('dateAdded');
$data = strtotime($data);
if ($data == NULL) {
$data = date("Y-m-d H:i:s");
$row->set_value("dateAdded",$data);
}
$data = $row->get_value('dateLastEdited');
$data = strtotime($data);
if ($data == NULL) {
$data = date("Y-m-d H:i:s");
$row->set_value("dateLastEdited",$data);
}
}
$datagrid->event->attach("beforeRender","formatting");
$datagrid->event->attach("beforeUpdate","formatting2");
$datagrid->event->attach("BeforeInsert","formatting2");
$datagrid->dynamic_loading(50);
if ($datagrid->is_select_mode()) {
$datagrid->render_sql($sql_query, "id", "...");
}
else
$datagrid->render_table("SomeTable", "id", "...");
?>[/code]
And this code don’t return any errors.
dp.attachEvent("onAfterUpdate", function(sid, action, tid, tag){
alert("sync: "+tag.getAttribute("sync")+", type: "+tag.getAttribute("type"));
return true;
})
It always return for “sync” attribute “null”-value.
You can use code like next to add custom attributes to server side response.
function responseDetails($action){
//after executing db operation you can place any custom attribute on response
if (some_custom_logic($action))
$action->set_response_attribute("sync", "some value");
}
$datagrid->event->attach("afterProcessing","responseDetails");
I don’t know the structure of action to process it.
When and where is filled array _POST[]?
I found that before process, that is in your DHTMLX php library, this array _POST[] is filled yet and parameter “!nativeeditor_status” has value.