summaryrefslogtreecommitdiffstats
path: root/codebase/Dhtmlx/Connector/KeyGridConnector.php
diff options
context:
space:
mode:
Diffstat (limited to 'codebase/Dhtmlx/Connector/KeyGridConnector.php')
-rw-r--r--codebase/Dhtmlx/Connector/KeyGridConnector.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/codebase/Dhtmlx/Connector/KeyGridConnector.php b/codebase/Dhtmlx/Connector/KeyGridConnector.php
new file mode 100644
index 0000000..001cae9
--- /dev/null
+++ b/codebase/Dhtmlx/Connector/KeyGridConnector.php
@@ -0,0 +1,24 @@
+<?php
+namespace Dhtmlx\Connector;
+
+class KeyGridConnector extends GridConnector {
+ public function __construct($res,$type=false,$item_type=false,$data_type=false){
+ if (!$item_type) $item_type="GridDataItem";
+ if (!$data_type) $data_type="KeyGridDataProcessor";
+ parent::__construct($res,$type,$item_type,$data_type);
+
+ $this->event->attach("beforeProcessing",array($this,"before_check_key"));
+ $this->event->attach("afterProcessing",array($this,"after_check_key"));
+ }
+
+ public function before_check_key($action){
+ if ($action->get_value($this->config->id["name"])=="")
+ $action->error();
+ }
+ public function after_check_key($action){
+ if ($action->get_status()=="inserted" || $action->get_status()=="updated"){
+ $action->success($action->get_value($this->config->id["name"]));
+ $action->set_status("inserted");
+ }
+ }
+}; \ No newline at end of file