Ejemplo n.º 1
0
 public function __toString()
 {
     if ($this->_provider) {
         $this->_provider->setup_grid();
     }
     $string = '<table id="' . $this->_identifier . '"></table>';
     $string .= '<div id="p_' . $this->_identifier . '"></div>';
     $string .= '<script type="text/javascript">//<![CDATA[' . "\n";
     $string .= $this->_prepend_js;
     $string .= 'org_openpsa_grid_helper.setup_grid("' . $this->_identifier . '", {';
     $colnames = array();
     foreach ($this->_columns as $name => $column) {
         if ($column['separate_index']) {
             $colnames[] = 'index_' . $name;
         }
         $colnames[] = $column['label'];
     }
     $string .= "\ncolNames: " . json_encode($colnames) . ",\n";
     $string .= $this->_render_colmodel();
     $total_options = sizeof($this->_options);
     $i = 0;
     foreach ($this->_options as $name => $value) {
         $string .= $name . ': ' . $value;
         if (++$i < $total_options) {
             $string .= ',';
         }
         $string .= "\n";
     }
     $string .= "});\n";
     if ($this->get_option('footerrow')) {
         $string .= 'jQuery("#' . $this->_identifier . '").jqGrid("footerData", "set", ' . json_encode($this->_footer_data) . ");\n";
     }
     $string .= '//]]></script>';
     return $string;
 }