diff options
author | Stanislau Wolski <stanislau.wolski@gmail.com> | 2016-01-14 18:13:03 +0300 |
---|---|---|
committer | Stanislau Wolski <stanislau.wolski@gmail.com> | 2016-01-14 18:13:03 +0300 |
commit | a33568027e4fe48561708bea0bf813f82605793c (patch) | |
tree | ebd906e049a04805c14d23fd689da5b9cb4292af /codebase/Dhtmlx | |
parent | fb4a14505901b75a5b04954c684ef08dfde16f2d (diff) | |
parent | 89c97bba52d864a0f24dd566f31fb04912c3c2d9 (diff) | |
download | connector-php-a33568027e4fe48561708bea0bf813f82605793c.zip connector-php-a33568027e4fe48561708bea0bf813f82605793c.tar.gz connector-php-a33568027e4fe48561708bea0bf813f82605793c.tar.bz2 |
Merge pull request #8 from matak/modern
added, global user data for grid
Diffstat (limited to 'codebase/Dhtmlx')
-rw-r--r-- | codebase/Dhtmlx/Connector/GridConnector.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/codebase/Dhtmlx/Connector/GridConnector.php b/codebase/Dhtmlx/Connector/GridConnector.php index 3c2b2f6..7429c58 100644 --- a/codebase/Dhtmlx/Connector/GridConnector.php +++ b/codebase/Dhtmlx/Connector/GridConnector.php @@ -6,6 +6,8 @@ use Dhtmlx\Connector\Data\DataRequestConfig; /*! Connector for the dhtmlxgrid **/ class GridConnector extends Connector { + + protected $userdata; /*! constructor @@ -20,6 +22,8 @@ class GridConnector extends Connector { name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default. */ public function __construct($res,$type=false,$item_type=false,$data_type=false,$render_type=false){ + $this->userdata=false; + if (!$item_type) $item_type="Dhtmlx\\Connector\\Data\\GridDataItem"; if (!$data_type) $data_type="Dhtmlx\\Connector\\DataProcessor\\GridDataProcessor"; if (!$render_type) $render_type="Dhtmlx\\Connector\\Output\\RenderStrategy"; @@ -102,12 +106,20 @@ class GridConnector extends Connector { if ($this->dload){ if ($pos=$this->request->get_start()) - return "<rows pos='".$pos."'".$attributes.">"; + $str = "<rows pos='".$pos."'".$attributes.">"; else - return "<rows total_count='".$this->sql->get_size($this->request)."'".$attributes.">"; + $str = "<rows total_count='".$this->sql->get_size($this->request)."'".$attributes.">"; } else - return "<rows".$attributes.">"; + $str = "<rows".$attributes.">"; + + if ($this->userdata !== false) { + foreach ($this->userdata as $key => $value) { + $str .= "<userdata name='".$key."'><![CDATA[".$value."]]></userdata>"; + } + } + + return $str; } @@ -117,6 +129,14 @@ class GridConnector extends Connector { return $this->extra_output."</rows>"; } + //set global userdata for grid + public function set_userdata($name, $value){ + if ($this->userdata === false) + $this->userdata = array(); + + $this->userdata[$name]=$value; + } + public function set_config($config = false){ if (gettype($config) == 'boolean') $config = new GridConfiguration($config); |