当前位置: 首页>>代码示例>>PHP>>正文


PHP jqgrid::set_columns方法代码示例

本文整理汇总了PHP中jqgrid::set_columns方法的典型用法代码示例。如果您正苦于以下问题:PHP jqgrid::set_columns方法的具体用法?PHP jqgrid::set_columns怎么用?PHP jqgrid::set_columns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jqgrid的用法示例。


在下文中一共展示了jqgrid::set_columns方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex


//.........这里部分代码省略.........
        $col["dbname"] = "addresses.Phone"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["viewable"] = true;
        $cols[] = $col;

        $col = array();
        $col["title"] = "Fax"; // caption of column
        $col["name"] = "Fax";
        $col["dbname"] = "addresses.Fax"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["viewable"] = true;
        $col["search"] = false;
        $cols[] = $col;

        $g = new jqgrid();

        $grid["caption"] = "Documents";
       // $grid["multiselect"] = true;
        $grid["autowidth"] = true;
        $grid["resizable"] = true;
        //$grid["toppager"] = true;
        $grid["sortname"] = 'documents.Document_ID';
        $grid["sortorder"] = "ASC";
        $grid["add_options"] = array(
            'width'=>'420',
            "closeAfterEdit"=>true, // close dialog after add/edit
            "top"=>"200", // absolute top position of dialog
            "left"=>"200" // absolute left position of dialog
        );

        $g->set_options($grid);

        $g->set_actions(array(
                "add"=>false, // allow/disallow add
                "edit"=>true, // allow/disallow edit
                "delete"=>true, // allow/disallow delete
                "rowactions"=>true, // show/hide row wise edit/del/save option
                "export"=>true, // show/hide export to excel option
                "autofilter" => true, // show/hide autofilter for search
                "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
            )
        );

        $g->select_command = "SELECT   addresses.*, persons.*, users.Default_Project,
                                       users.User_Login, users.User_Type, users.Last_Login, users.Active,
                                       users.Last_IP, documents.*, images.File_Name, images.Mime_Type
                              FROM documents
                              LEFT JOIN images ON images.Document_ID = documents.Document_ID
                              LEFT JOIN users ON users.User_ID = documents.User_ID
                              LEFT JOIN persons ON users.Person_ID = persons.Person_ID
                              LEFT JOIN person_addresses ON person_addresses.Person_ID = persons.Person_ID
                              LEFT JOIN addresses ON addresses.Address_ID = person_addresses.Address_ID";

        // set database table for CRUD operations
        $g->table = "documents";

        $g->set_columns($cols);

        // group columns header
        $g->set_group_header( array(
                "useColSpanStyle"=>true,
                "groupHeaders"=>array(
                    array(
                        "startColumnName"=>'Document_ID', // group starts from this column
                        "numberOfColumns"=>3, // group span to next 2 columns
                        "titleText"=>'Document Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'File_Name', // group starts from this column
                        "numberOfColumns"=>2, // group span to next 2 columns
                        "titleText"=>'Image Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'User_ID', // group starts from this column
                        "numberOfColumns"=>7, // group span to next 2 columns
                        "titleText"=>'User Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'First_Name', // group starts from this column
                        "numberOfColumns"=>6, // group span to next 2 columns
                        "titleText"=>'Person Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'Address1', // group starts from this column
                        "numberOfColumns"=>8, // group span to next 2 columns
                        "titleText"=>"User's Address" // caption of group header
                    )
                )
            )
        );

        // render grid and get html/js output
        $out = $g->render("documents");

        $this->render('index',array(
            'out'=>$out,
        ));
	}
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:DocumentsController.php

示例2: index

 public function index()
 {
     //echo $this->session->userdata('user_id');
     if ($this->session->userdata('user_name')) {
         $i_rule = $this->session->userdata('user_cizacl_role_id');
         if ($this->cizacl->check_isAllowed($i_rule, 'income', 'index')) {
             // master grid
             $grid = new jqgrid();
             $opt["caption"] = $this->lang->line('factory');
             // following params will enable subgrid -- by default first column (PK) of parent is passed as param 'id'
             $opt["detail_grid_id"] = "list2";
             //$opt['width'] = 300;
             $opt['autowidth'] = true;
             $opt['height'] = "60";
             // extra params passed to detail grid, column name comma separated
             //$opt["subgridparams"] = "client_id,gender,company";
             $opt["subgridparams"] = "factory_id,factory_code,factory_name";
             #set Grid Option
             $grid->set_options($opt);
             $grid->select_command = "SELECT * FROM transport_factory WHERE factory_status =1";
             #Select table
             $grid->table = "transport_factory";
             /*Define Column*/
             #ID
             $col = array();
             $col["title"] = $this->lang->line('id');
             // caption of column
             $col["name"] = "factory_id";
             // field name, must be exactly same as with SQL prefix or db field
             $col["width"] = "10";
             $col["editable"] = false;
             $col['hidden'] = true;
             $cols[] = $col;
             #Factory code
             $col = array();
             $col['title'] = $this->lang->line('factory_code');
             $col['name'] = "factory_code";
             $col["editable"] = false;
             $cols[] = $col;
             $col = array();
             $col['title'] = $this->lang->line('factory_name');
             $col['name'] = "factory_name";
             //$col["width"] = "10";
             $col["editable"] = false;
             $cols[] = $col;
             $grid->set_columns($cols);
             $grid->set_actions(array("add" => false, "edit" => false, "delete" => false, "rowactions" => false, "autofilter" => false));
             //Display master
             $out_master = $grid->render("list1");
             // detail grid
             $grid = new jqgrid();
             $opt = array();
             $opt["sortname"] = 'income_date';
             // by default sort grid by this field
             $opt["sortorder"] = "desc";
             // ASC or DESC
             $opt["height"] = 300;
             // autofit height of subgrid
             $opt["rowNum"] = 10;
             // by default 20
             $opt['rowList'] = array(10, 20, 30, 100, 1000);
             $opt["autowidth"] = true;
             $opt["caption"] = $this->lang->line('income_invoice');
             // caption of grid
             //$opt["multiselect"] = true; // allow you to multi-select through checkboxes
             //footer
             $opt["footerrow"] = true;
             $opt["reloadedit"] = true;
             // Check if master record is selected before detail addition
             $opt["add_options"]["beforeInitData"] = "function(formid){ var selr = jQuery('#list1').jqGrid('getGridParam','selrow'); if (!selr) { alert('Please select master record first'); return false; } }";
             $opt["add_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '420');
             $opt["edit_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '420');
             $opt["add_options"]["topinfo"] = $this->lang->line('income_title_from_add');
             $opt["add_options"]["bottominfo"] = $this->lang->line('remark_numberic');
             $opt["add_options"]["afterShowForm"] = 'function(formid) { jQuery("#ref_number").focus(); }';
             $opt["form"]["position"] = "left";
             $opt["form"]["nav"] = true;
             $opt["multiselect"] = false;
             $opt["rownumbers"] = true;
             // disable all dialogs except edit
             $grid->navgrid["param"]["edit"] = false;
             $grid->navgrid["param"]["add"] = false;
             $grid->navgrid["param"]["del"] = false;
             $grid->navgrid["param"]["search"] = false;
             $grid->navgrid["param"]["refresh"] = true;
             // enable inline editing buttons
             $grid->set_actions(array("inline" => true, "rowactions" => true));
             // Properties Grids
             $grid->set_options($opt);
             $grid->set_actions(array("add" => $this->cizacl->check_isAllowed($i_rule, 'income', 'add'), "edit" => $this->cizacl->check_isAllowed($i_rule, 'income', 'edit'), "delete" => $this->cizacl->check_isAllowed($i_rule, 'income', 'delete'), "rowactions" => true, "export" => false, "autofilter" => true, "search" => "advance"));
             $id = intval($_GET["rowid"]);
             $factory_code = $_GET["factory_code"];
             $company = $_GET["factory_name"];
             $cid = intval($_GET["factory_id"]);
             // for non-int fields as PK
             // $id = (empty($_GET["rowid"])?0:$_GET["rowid"]);
             // and use in sql for filteration
             //$grid->select_command = "SELECT id,client_id,invdate,amount,tax,total,'$company' as 'company' FROM invheader WHERE client_id = $cid";
             //$grid->select_command = "SELECT id,income_date,factory_id,ref_number,total_amount,note FROM `income` WHERE factory_id=$cid";
             $grid->select_command = "SELECT id,income_date,factory_id,ref_number,income_details,total_amount,note,(SELECT SUM(total_amount)FROM\tincome WHERE factory_id = {$cid}\t) AS table_total FROM\t`income`WHERE\tfactory_id = {$cid}";
//.........这里部分代码省略.........
开发者ID:arnon22,项目名称:transportcm,代码行数:101,代码来源:income.php

示例3: index

 public function index()
 {
     if ($this->session->userdata('user_name')) {
         $g = new jqgrid();
         $dispyPrice = $this->price->dispalyPrice();
         $titke_cubic = $this->price->header_cubic();
         $row_distance = $this->price->row_distance();
         $i = 0;
         foreach ($row_distance as $key => $val) {
             // $i = $val['distance_id'];
             foreach ($titke_cubic as $row) {
                 $data[$i]["id"] = $i;
                 $data[$i]["distacne"] = $dispyPrice[$i]['distance'];
                 $data[$i]['cubic'][$row->cubic_id] = 2 + $i;
                 //$dispyPrice[$i][$row->cubic_id];
                 $data[$i]["pricelist_id"] = $dispyPrice[$row->id];
             }
             $i = $val['distance_id'];
         }
         $g->table = $data;
         // ห$g->table = $pricelist;
         $col = array();
         $col["title"] = "id";
         // caption of column
         $col["name"] = "id";
         $col["width"] = "250";
         $col["sorttype"] = int;
         $col['editable'] = true;
         $col['hidden'] = true;
         $cols[] = $col;
         $col = array();
         $col["title"] = "pricelist_id";
         // caption of column
         $col["name"] = "pricelist_id";
         $col["width"] = "250";
         $col["sorttype"] = int;
         $col['editable'] = true;
         #$col['hidden'] = true;
         //$cols[] = $col;
         $col = array();
         $col["title"] = "Cubic /<br/> Distance";
         // caption of column
         $col["name"] = "distacne";
         $col["width"] = "350";
         $cols[] = $col;
         foreach ($titke_cubic as $row) {
             $col = array();
             $col['title'] = "{$row->cubic_value}";
             $col['name'] = "cubic[{$row->cubic_id}]";
             $col['editable'] = true;
             $col['search'] = false;
             $cols[] = $col;
         }
         $g->set_columns($cols);
         $e["js_on_select_row"] = "do_onselect";
         $e["on_update"] = array("do_update", null, true);
         $e["on_data_display"] = array("filter_display", null, true);
         $g->set_events($e);
         function filter_display($data)
         {
             /*
             These comments are just to show the input param format 
             Array 
             ( 
             [params] => Array 
             ( 
             [0] => Array 
             ( 
             [client_id] => 1 
             [name] => Client 1 
             [gender] => My custom malea 
             [company] => My custom Client 1 Company 1 
             ) 
             
             [1] => Array 
             ( 
             [client_id] => 2 
             [name] => Client 2 
             [gender] => male 
             [company] => Client 2 Com2pany 11 
             ) 
             
             ....... 
             */
             foreach ($data["params"] as &$d) {
                 foreach ($d as $k => $v) {
                     $d[$k] = strtoupper($d[$k]);
                 }
             }
         }
         function do_update(&$data)
         {
             //  $obj = &get_instance();
             print_r($data);
             $id = intval($_REQUEST["id"]);
         }
         $g->set_actions(array("add" => false, "edit" => true, "bulkedit" => true, "delete" => true, "rowactions" => true, "autofilter" => true, "search" => "simple"));
         $opt['caption'] = "d";
         $opt["sortname"] = 'id';
         // by default sort grid by this field
//.........这里部分代码省略.........
开发者ID:arnon22,项目名称:transportcm,代码行数:101,代码来源:pricelist.php

示例4: actionIndex


//.........这里部分代码省略.........
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = true;
        $col["sortable"] = true;
        $cols[] = $col;

        $col = array();
        $col["title"] = "Client ID"; // caption of column
        $col["name"] = "Client_ID";
        $col["dbname"] = "notes.Client_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = true;
        $col["sortable"] = true;
        $cols[] = $col;

        $col = array();
        $col["title"] = "Comment"; // caption of column
        $col["name"] = "Comment";
        $col["dbname"] = "notes.Comment"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = true; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = true;
        $col["sortable"] = true;
        $cols[] = $col;

        $col = array();
        $col["title"] = "Created"; // caption of column
        $col["name"] = "Created";
        $col["dbname"] = "notes.Created"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["viewable"] = true;
        $col["search"] = false;
        $cols[] = $col;


        $g = new jqgrid();

        $grid["caption"] = "Notes";
        // $grid["multiselect"] = true;
        $grid["autowidth"] = true;
        $grid["resizable"] = true;
        //$grid["toppager"] = true;
        $grid["sortname"] = 'notes.Note_ID';
        $grid["sortorder"] = "ASC";
        $grid["add_options"] = array(
            'width'=>'420',
            "closeAfterEdit"=>true, // close dialog after add/edit
            "top"=>"200", // absolute top position of dialog
            "left"=>"200" // absolute left position of dialog
        );

        $g->set_options($grid);

        $g->set_actions(array(
                "add"=>false, // allow/disallow add
                "edit"=>true, // allow/disallow edit
                "delete"=>true, // allow/disallow delete
                "rowactions"=>true, // show/hide row wise edit/del/save option
                "export"=>true, // show/hide export to excel option
                "autofilter" => true, // show/hide autofilter for search
                "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
            )
        );

        $g->select_command = "SELECT notes.*
                              FROM notes";

        // set database table for CRUD operations
        $g->table = "notes";

        $g->set_columns($cols);

        // group columns header
        $g->set_group_header( array(
                "useColSpanStyle"=>true,
                "groupHeaders"=>array(
                    array(
                        "startColumnName"=>'Note_ID', // group starts from this column
                        "numberOfColumns"=>7, // group span to next 2 columns
                        "titleText"=>'Note Information' // caption of group header
                    ),
                )
            )
        );

        // render grid and get html/js output
        $out = $g->render("notes");

        $this->render('index',array(
            'out'=>$out,
        ));
    }
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:NotesController.php

示例5: index


//.........这里部分代码省略.........
         $col["formatter"] = "date";
         // format as date
         $col["formatoptions"] = array("srcformat" => 'Y-m-d', "newformat" => 'd-m-Y', "opts" => array("changeYear" => false));
         $cols[] = $col;
         #ref_number
         $col = array();
         $col['title'] = $this->lang->line('ref_no');
         $col['name'] = "ref_number";
         $col["editable"] = true;
         // this column is editable
         $cols[] = $col;
         #tax Datail
         $col = array();
         $col['title'] = $this->lang->line('tax_detail');
         $col['name'] = "tax_details";
         $col["width"] = "170";
         $col["editable"] = true;
         // this column is editable
         $col['edittype'] = "textarea";
         $col["editoptions"] = array("rows" => "2", "cols" => "20");
         $col["editrules"] = array("required" => true);
         $col["formatter"] = "autocomplete";
         // autocomplete
         $col["formatoptions"] = array("sql" => "SELECT DISTINCT tax_details as k, tax_details as v FROM taxbuy", "search_on" => "tax_details", "update_field" => "tax_details");
         $cols[] = $col;
         #Price
         $col = array();
         $col['title'] = $this->lang->line('total_price');
         $col['name'] = "total_price";
         $col["editable"] = true;
         $col["editrules"] = array("number" => true, "required" => true);
         $col["editoptions"] = array("onblur" => "update_vat()");
         $col["align"] = "right";
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => '2');
         $col["search"] = false;
         $cols[] = $col;
         #vat
         $col = array();
         $col['title'] = $this->lang->line('vat');
         $col['name'] = "total_vat";
         $col["editable"] = true;
         $col["editrules"] = array("number" => true, "required" => true);
         #$col["editoptions"] = array("onblur" => "update_vat()");
         $col["formatter"] = "number";
         $col["align"] = "right";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => '2');
         $col["search"] = false;
         $cols[] = $col;
         #Total
         $col = array();
         $col['title'] = $this->lang->line('total_amount');
         $col["align"] = "right";
         $col['name'] = "total_amount";
         $col["editrules"] = array("number" => true, "required" => true);
         $col["editable"] = true;
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => '2');
         $col["search"] = false;
         $cols[] = $col;
         #Note
         $col = array();
         $col["title"] = $this->lang->line('remark');
         $col["name"] = "note";
         $col["width"] = "150";
         $col['editable'] = true;
         $col["edittype"] = "textarea";
         $col["editoptions"] = array("rows" => "2", "cols" => "20");
         $cols[] = $col;
         //$g->set_options($opt);
         $e["js_on_load_complete"] = "grid1_onload";
         $g->set_events($e);
         //Use Table
         $g->table = "taxbuy";
         // pass the cooked columns to grid
         $g->set_columns($cols);
         $opt["caption"] = $this->lang->line('buytax_list');
         $opt["sortname"] = 'tax_id';
         $opt["sortorder"] = "desc";
         $opt['rowNum'] = 10;
         $opt['rowList'] = array(10, 20, 30, 100);
         $opt["autowidth"] = true;
         $opt["footerrow"] = true;
         $opt["reloadedit"] = true;
         $opt["add_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '400');
         $opt["edit_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '400');
         $opt["add_options"]["afterShowForm"] = 'function(formid) { jQuery("#ref_number").focus(); }';
         $opt["edit_options"]["afterShowForm"] = 'function(formid) { jQuery("#ref_number").focus(); }';
         $g->set_options($opt);
         $g->set_actions(array("add" => $this->cizacl->check_isAllowed($i_rule, 'buytax', 'add_buytax'), "edit" => $this->cizacl->check_isAllowed($i_rule, 'buytax', 'edit_buytax'), "delete" => $this->cizacl->check_isAllowed($i_rule, 'buytax', 'del_buytax'), "view" => false, "rowactions" => false, "autofilter" => true, "search" => "advance", "inlineadd" => false, "showhidecolumns" => false));
         // render grid and get html/js output
         $out_index = $g->render("list1");
         $h2_title = $this->lang->line('buytax');
         //display
         $this->_example_output((object) array('output' => '', 'out' => $out_index, 'h2_title' => $h2_title, 'js_files' => array(), 'css_files' => array()));
     } else {
         //If no session, redirect to login page
         redirect('login', 'refresh');
     }
 }
开发者ID:arnon22,项目名称:transportcm,代码行数:101,代码来源:buytax.php

示例6: add_client

// with default display of textbox with size 20
$col["editrules"] = array("required" => true);
// and is required
$cols[] = $col;
$col = array();
$col["title"] = "Amount";
$col["name"] = "amount";
$col["width"] = "50";
$col["editable"] = true;
// this column is editable
$col["editoptions"] = array("size" => 20);
// with default display of textbox with size 20
$col["editrules"] = array("required" => true);
// and is required
$cols[] = $col;
$grid->set_columns($cols);
$e["on_insert"] = array("add_client", null, true);
$grid->set_events($e);
function add_client(&$data)
{
    $id = intval($_GET["rowid"]);
    $data["params"]["client_id"] = $id;
}
// generate grid output, with unique grid name as 'list1'
$out_detail = $grid->render("list2");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
	<link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/start/jquery-ui.custom.css"></link>	
	<link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.css"></link>	
开发者ID:ra-ckhar,项目名称:www,代码行数:31,代码来源:master-detail.php

示例7: pregledRezervacije

 public function pregledRezervacije($id, $ime)
 {
     $col = array();
     $col["title"] = "Datum";
     $col["name"] = "reservation_week";
     $col["width"] = "20";
     $cols[] = $col;
     $col = array();
     $col["title"] = "Dvorana";
     $col["name"] = "reservation_day";
     $col["width"] = "10";
     $cols[] = $col;
     $col = array();
     $col["title"] = "Termin";
     $col["name"] = "reservation_time";
     $col["width"] = "20";
     $cols[] = $col;
     $col = array();
     $col["title"] = "Poveznica";
     $col["name"] = "event_name";
     $col["width"] = "20";
     $col["editable"] = true;
     $col["summaryType"] = "count";
     $col["edittype"] = "checkbox";
     $col["editoptions"] = array("value" => $ime . ": ");
     $cols[] = $col;
     $g = new jqgrid();
     // $grid["url"] = ""; // your paramterized URL -- defaults to REQUEST_URI
     $grid["rowNum"] = 20;
     // by default 20
     $grid["sortname"] = 'reservation_day';
     // by default sort grid by this field
     $grid["sortorder"] = "desc";
     // ASC or DESC
     $grid["caption"] = "Vase rezervacije dvorana; Poveznice za kolegij -" . $ime;
     //$grid["autowidth"] = true; // expand grid to screen width
     $grid["width"] = "850";
     $grid["height"] = "550";
     $grid["multiselect"] = true;
     // allow you to multi-select through checkboxes
     $grid["hiddengrid"] = true;
     $grid["grouping"] = true;
     //
     $grid["groupingView"] = array();
     $grid["groupingView"]["groupField"] = array("reservation_week");
     // specify column name to group listing
     $grid["groupingView"]["groupColumnShow"] = array(true);
     // either show grouped column in list or not (default: true)
     //$grid["groupingView"]["groupText"] = array("<b>{0} - {1} Item(s)</b>"); // {0} is grouped value, {1} is count in group
     $grid["groupingView"]["groupOrder"] = array("asc");
     // show group in asc or desc order
     $grid["groupingView"]["groupDataSorted"] = array(true);
     // show sorted data within group
     $grid["groupingView"]["groupSummary"] = array(true);
     // work with summaryType, summaryTpl, see column: $col["name"] = "total";
     $grid["groupingView"]["groupCollapse"] = false;
     // Turn true to show group collapse (default: false)
     $grid["groupingView"]["showSummaryOnHide"] = true;
     // show summary row even if group collapsed (hide)
     // export XLS file
     // export to excel parameters
     $grid["export"] = array("format" => "xlsx", "filename" => "my-file", "sheetname" => "test");
     // RTL support
     // $grid["direction"] = "rtl";
     $grid["cellEdit"] = true;
     // inline cell editing, like spreadsheet
     $g->set_options($grid);
     $g->set_actions(array("add" => true, "edit" => true, "delete" => true, "rowactions" => true, "export" => true, "autofilter" => true, "search" => "advance"));
     // set database table for CRUD operations
     $g->table = 'phpmyreservation_reservations';
     $g->set_columns($cols);
     // subqueries are also supported now (v1.2)
     $g->select_command = "select * from (SELECT `reservation_week` , `reservation_day` , `reservation_time` , `event_name` \nFROM `phpmyreservation_reservations` \nWHERE `reservation_user_id`=" . $id . ") as o";
     $grid_id = "dvorane1";
     // render grid
     $out = $g->render($grid_id);
     $sql = "SELECT `reservation_week` , `reservation_day` , `reservation_time` , `event_name`  FROM `phpmyreservation_reservations` WHERE `reservation_user_id`=" . $id;
     return array('out' => $out, 'grid_id' => $grid_id, 'sql' => $sql, 'naziv' => $grid["caption"], 'cols' => $cols);
 }
开发者ID:kristijana,项目名称:Administriranje,代码行数:79,代码来源:grid_postavke.php

示例8: actionIndex


//.........这里部分代码省略.........
        $col["dbname"] = "addresses.Phone"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["viewable"] = true;
        $cols[] = $col;

        $col = array();
        $col["title"] = "Fax"; // caption of column
        $col["name"] = "Fax";
        $col["dbname"] = "addresses.Fax"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["viewable"] = true;
        $col["search"] = false;
        $cols[] = $col;


        $g = new jqgrid();

        $grid["caption"] = "Payments";
       // $grid["multiselect"] = true;
        $grid["autowidth"] = true;
        $grid["resizable"] = true;
        //$grid["toppager"] = true;
        $grid["sortname"] = 'companies.Company_Name';
        $grid["sortorder"] = "ASC";
        $grid["add_options"] = array(
            'width'=>'420',
            "closeAfterEdit"=>true, // close dialog after add/edit
            "top"=>"200", // absolute top position of dialog
            "left"=>"200" // absolute left position of dialog
        );

        $g->set_options($grid);

        $g->set_actions(array(
                "add"=>false, // allow/disallow add
                "edit"=>true, // allow/disallow edit
                "delete"=>true, // allow/disallow delete
                "rowactions"=>true, // show/hide row wise edit/del/save option
                "export"=>true, // show/hide export to excel option
                "autofilter" => true, // show/hide autofilter for search
                "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
            )
        );

        $g->select_command = "SELECT   companies.*, addresses.*,
                                       payments.*, bank_acct_nums.Account_Number, bank_acct_nums.Account_Name,
                                       bank_acct_nums.Bank_Name, bank_acct_nums.Bank_Routing, bank_acct_nums.Bank_SWIFT,
                                       images.File_Name, images.Mime_Type
                              FROM payments
                              LEFT JOIN documents ON documents.Document_ID = payments.Document_ID
                              LEFT JOIN images ON images.Document_ID = documents.Document_ID
                              LEFT JOIN bank_acct_nums ON bank_acct_nums.Account_Num_ID = payments.Account_Num_ID
                              LEFT JOIN vendors ON payments.Vendor_ID = vendors.Vendor_ID
                              LEFT JOIN clients ON clients.Client_ID = vendors.Vendor_Client_ID
                              LEFT JOIN companies ON clients.Company_ID = companies.Company_ID
                              LEFT JOIN company_addresses ON company_addresses.Company_ID = companies.Company_ID
                              LEFT JOIN addresses ON addresses.Address_ID = company_addresses.Address_ID";

        // set database table for CRUD operations
        $g->table = "payments";

        $g->set_columns($cols);

        // group columns header
        $g->set_group_header( array(
                "useColSpanStyle"=>true,
                "groupHeaders"=>array(
                    array(
                        "startColumnName"=>'Payment_ID', // group starts from this column
                        "numberOfColumns"=>10, // group span to next 2 columns
                        "titleText"=>'Payment Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'File_Name', // group starts from this column
                        "numberOfColumns"=>2, // group span to next 2 columns
                        "titleText"=>'Image Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'Company_ID', // group starts from this column
                        "numberOfColumns"=>6, // group span to next 2 columns
                        "titleText"=>'Company Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'Address1', // group starts from this column
                        "numberOfColumns"=>8, // group span to next 2 columns
                        "titleText"=>"Company's Address" // caption of group header
                    )
                )
            )
        );

        // render grid and get html/js output
        $out = $g->render("payments");

        $this->render('index',array(
            'out'=>$out,
        ));
	}
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:PaymentsController.php

示例9: index


//.........这里部分代码省略.........
         $opt["form"]["position"] = "center";
         // or "all"
         $g->set_options($opt);
         $g->set_actions(array("add" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'add'), "edit" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'edit'), "delete" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'delete'), "rowactions" => false, "export" => true, "autofilter" => true, "search" => "advance"));
         $g->select_command = "SELECT\n\tid,\n\tdp_number,\n\torders.customer_id,\n    cus.customers_name AS cid,\n    orders.factory_id,\n\tfac.factory_code,\n\treal_distance,\n\torders.distance_id,\n\tdis.distance_code,\t\n    cubic.cubic_value as cubic_id,\n    orders.price AS price,\n\torders.use_oil,\n    orders.car_id,\n\tcar.car_number,\n\torders.driver_id,\n\tdri.driver_name,\n    order_date,\n    orders.delivery_datetime,\n    orders.remark\n\nFROM\n\t`orders` AS orders\nLEFT JOIN transport_factory AS fac ON (\n\torders.factory_id = fac.factory_id\n)\nLEFT JOIN transport_customers AS cus ON (\n\torders.customer_id = cus.customer_id\n)\nLEFT JOIN transport_cubiccode AS cubic ON (\n\torders.cubic_id = cubic.cubic_id\n)\nLEFT JOIN distancecode AS dis ON (\n\torders.distance_id = dis.distance_id\n)\nLEFT JOIN transport_cars AS car ON (\norders.car_id = car.car_id\n)\nLEFT JOIN driver AS dri ON (\n\torders.driver_id = dri.driver_id\n)";
         // this db table will be used for add,edit,delete
         $g->table = "orders";
         $e["on_insert"] = array("add_order", null, true);
         $e["on_after_insert"] = array("after_insert", null, true);
         $e["on_update"] = array("do_update", null, true);
         $e["on_data_display"] = array("filter_display", null, true);
         $g->set_events($e);
         function add_order(&$data)
         {
             //print_r($data);
             $obj =& get_instance();
             $obj->load->model("price_model", "pricelist");
             //$id = intval($_REQUEST["id"]);
             $factory_id = $data["params"]["factory_id"];
             $distance_id = $data["params"]["distance_id"];
             $cubid_id = $data["params"]["cubic_id"];
             $order_date = $data["params"]["order_date"];
             #get price
             $order_price = $obj->pricelist->get_order_Price($factory_id, $cubid_id, $distance_id, $order_date);
             if ($order_price == null) {
                 $str = ob_get_clean();
                 $str = "ยังไม่มีการกำหนดราคาค่าขนส่ง";
                 phpgrid_error($str);
             }
             /*check DP NUmber*/
             $check_sql = "SELECT count(*) as c from orders where LOWER(`dp_number`) = '" . strtolower($data["params"]["dp_number"]) . "'";
             $rs = mysql_fetch_assoc(mysql_query($check_sql));
             if ($rs["c"] > 0) {
                 phpgrid_error("หมายเลข DP Number ซ้ำ");
             }
             /*End Check DP Number*/
             //$str = "UPDATE orders SET price ='{$data["parmas"]["price"]}' WHERE id = '{$data["id"]}'";
             //mysql_query($str);
         }
         function do_update(&$data)
         {
             //print_r($data);
             $obj =& get_instance();
             $obj->load->model("price_model", "pricelist");
             $id = intval($_REQUEST["id"]);
             $factory_id = $data["params"]["factory_id"];
             $distance_id = $data["params"]["distance_id"];
             $cubid_id = $data["params"]["cubic_id"];
             $order_date = $data["params"]["order_date"];
             #get price
             $order_price = $obj->pricelist->get_order_Price($factory_id, $cubid_id, $distance_id, $order_date);
             if ($order_price == null) {
                 $str = ob_get_clean();
                 $str = "ยังไม่มีการกำหนดราคาค่าขนส่ง";
                 phpgrid_error($str);
             } else {
                 $data["params"]["price"] = $order_price;
                 $str = "UPDATE orders SET price ='{$data["parmas"]["price"]}' WHERE id = '{$data["id"]}'";
                 mysql_query($str);
             }
             //$str = "UPDATE orders SET price ='{$data["parmas"]["price"]}' WHERE id = '{$data["id"]}'";
             //mysql_query($str);
         }
         function after_insert(&$data)
         {
             //print_r($data);
             $obj =& get_instance();
             $obj->load->model("price_model", "pricelist");
             $id = $data["id"];
             $factory_id = $data["params"]["factory_id"];
             $distance_id = $data["params"]["distance_id"];
             $cubid_id = $data["params"]["cubic_id"];
             $order_date = $data["params"]["order_date"];
             #get price
             $order_price = $obj->pricelist->get_order_Price($factory_id, $cubid_id, $distance_id, $order_date);
             $str = "UPDATE orders SET price ='{$order_price}' \n                    WHERE id = {$data["id"]}";
             mysql_query($str);
         }
         function filter_display(&$data)
         {
             foreach ($data["params"] as &$d) {
                 foreach ($d as $k => $v) {
                     $d[$k] = strtoupper($d[$k]);
                 }
             }
         }
         // pass the cooked columns to grid
         $g->set_columns($cols);
         // generate grid output, with unique grid name as 'list1'
         $out = $g->render("list1");
         $iprice = $this->price->get_order_Price(2, 2, 2);
         $h2_title = $this->lang->line('order_car_truck');
         //display
         $this->_example_output((object) array('output' => "", 'out' => $out, 'h2_title' => $h2_title, 'iprice' => $iprice, 'js_files' => array(), 'css_files' => array()));
         //$this->_example_output();
     } else {
         redirect('login', 'refresh');
     }
     //end if
 }
开发者ID:arnon22,项目名称:transportcm,代码行数:101,代码来源:truckorder.php

示例10: getDataGrid

 function getDataGrid($id)
 {
     $g = new jqgrid();
     $this->db = $this->cx->conectar();
     $type = 'gridoptions';
     $result = $this->db->Execute("SELECT b.nb_property_fld,b.nb_type_fld,a.nb_value_fld FROM nb_datagrid_tbl a , nb_config_frmwrk_tbl b WHERE  a.nb_config_frmwrk_id_fld = b.nb_config_frmwrk_id_fld and b.nb_config_type_fld='{$type}' and a.nb_id_page_fld = '{$id}'");
     while ($row = $result->FetchRow()) {
         $value = $row[2];
         if ($row[0] != 'table') {
             if ($row[1] == 'number') {
                 $value = (int) $value;
             }
             if ($row[1] == 'boolean') {
                 if ($value == 'true') {
                     $value = true;
                 } else {
                     $value = false;
                 }
             }
             $grid[$row[0]] = $value;
         } else {
             $g->table = $value;
         }
     }
     $this->campos = $this->db->Execute("Select distinct a.nb_column_fld from nb_datagridcol_tbl a where a.nb_id_page_fld = '{$id}'");
     $type = 'gridcoloptions';
     while ($camposDescribe = $this->campos->FetchRow()) {
         $result = $this->db->Execute("SELECT b.nb_property_fld,b.nb_type_fld,a.nb_value_fld FROM nb_datagridcol_tbl a , nb_config_frmwrk_tbl b WHERE  a.nb_config_frmwrk_id_fld = b.nb_config_frmwrk_id_fld and b.nb_config_type_fld='{$type}' and a.nb_id_page_fld = '{$id}' and a.nb_column_fld='{$camposDescribe['0']}'");
         $col = array();
         while ($row = $result->FetchRow()) {
             $value = $row[2];
             if ($row[1] == 'number') {
                 $value = (int) $value;
             }
             if ($row[1] == 'boolean') {
                 if ($value == 'true') {
                     $value = true;
                 } else {
                     $value = false;
                 }
             }
             $col[$row[0]] = $value;
         }
         $cols[] = $col;
     }
     $g->set_columns($cols);
     $g->set_options($grid);
     $g->set_actions(array("add" => false, "edit" => false, "delete" => false, "rowactions" => false, "search" => "advance", "export" => false, "autofilter" => true));
     return $g->render("list1");
 }
开发者ID:cagc4,项目名称:Nabu,代码行数:50,代码来源:Utilities.php

示例11: actionIndex

	/**
	 * Lists all models.
	 */
	public function actionIndex()
	{
        if (isset($_POST['oper']) && $_POST['oper'] == 'del') {
            $w9RevId = trim($_POST["id"]);
            $w9Rev = W9Revisions::model()->findByAttributes(array(
                'Revision_ID' => $w9RevId,
            ));
            $w9s = W9::model()->findByAttributes(array(
                'Revision_ID' => $w9RevId,
            ));
            if ($w9Rev && !$w9s) {
                $w9Rev->delete();
            }
            die;
        }

        $conn = mysql_connect(Yii::app()->params->dbhost, Yii::app()->params->dbuser, Yii::app()->params->dbpassword);
        mysql_select_db(Yii::app()->params->dbname);
        mysql_query("SET NAMES 'utf8'");

        Yii::import('ext.phpgrid.inc.jqgrid');

        // set columns
        $col = array();
        $col["title"] = "Revision ID"; // caption of column
        $col["name"] = "Revision_ID";
        $col["dbname"] = "Revision_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = true;
        $col["sortable"] = true;
        $cols[] = $col;

        // set columns
        $col = array();
        $col["title"] = "Description"; // caption of column
        $col["name"] = "Description";
        $col["dbname"] = "Description"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = true;
        $col["sortable"] = true;
        $cols[] = $col;


        $g = new jqgrid();

        $grid["caption"] = "W9 Revisions";
       // $grid["multiselect"] = true;
        $grid["autowidth"] = true;
        $grid["resizable"] = true;
        //$grid["toppager"] = true;
        $grid["sortname"] = 'Revision_ID';
        $grid["sortorder"] = "ASC";
        $grid["add_options"] = array(
            'width'=>'420',
            "closeAfterEdit"=>true, // close dialog after add/edit
            "top"=>"200", // absolute top position of dialog
            "left"=>"200" // absolute left position of dialog
        );

        $g->set_options($grid);

        $g->set_actions(array(
                "add"=>true, // allow/disallow add
                "edit"=>true, // allow/disallow edit
                "delete"=>true, // allow/disallow delete
                "rowactions"=>true, // show/hide row wise edit/del/save option
                "export"=>true, // show/hide export to excel option
                "autofilter" => true, // show/hide autofilter for search
                "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
            )
        );

        $g->select_command = "SELECT   *
                              FROM w9_revisions";

        // set database table for CRUD operations
        $g->table = "w9_revisions";

        $g->set_columns($cols);

        // group columns header
        $g->set_group_header( array(
                "useColSpanStyle"=>true,
                "groupHeaders"=>array(
                    array(
                        "startColumnName"=>'Revision_ID', // group starts from this column
                        "numberOfColumns"=>2, // group span to next 2 columns
                        "titleText"=>'W9 Revisions' // caption of group header
                    ),
                )
            )
//.........这里部分代码省略.........
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:W9revisionsController.php

示例12: actionIndex


//.........这里部分代码省略.........
        $col = array();
        $col["title"] = "Country"; // caption of column
        $col["name"] = "Country";
        $col["dbname"] = "addresses.Country"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["viewable"] = true;
        $cols[] = $col;

        $col = array();
        $col["title"] = "Phone"; // caption of column
        $col["name"] = "Phone";
        $col["dbname"] = "addresses.Phone"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["viewable"] = true;
        $cols[] = $col;

        $col = array();
        $col["title"] = "Fax"; // caption of column
        $col["name"] = "Fax";
        $col["dbname"] = "addresses.Fax"; // grid column name, same as db field or alias from sql
        $col["resizable"] = true;
        $col["editable"] = true; // this column is editable
        $col["viewable"] = true;
        $col["search"] = false;
        $cols[] = $col;

        $g = new jqgrid();

        $grid["caption"] = "Clients";
       // $grid["multiselect"] = true;
        $grid["autowidth"] = true;
        $grid["resizable"] = true;
        //$grid["toppager"] = true;
        $grid["sortname"] = 'companies.Company_Name';
        $grid["sortorder"] = "ASC";
        $grid["add_options"] = array(
            'width'=>'420',
            "closeAfterEdit"=>true, // close dialog after add/edit
            "top"=>"200", // absolute top position of dialog
            "left"=>"200" // absolute left position of dialog
        );

        $g->set_options($grid);

        $g->set_actions(array(
                "add"=>false, // allow/disallow add
                "edit"=>true, // allow/disallow edit
                "delete"=>true, // allow/disallow delete
                "rowactions"=>true, // show/hide row wise edit/del/save option
                "export"=>true, // show/hide export to excel option
                "autofilter" => true, // show/hide autofilter for search
                "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
            )
        );

        $g->select_command = "SELECT  clients.Client_ID, clients.Client_Number, clients.Client_Logo_Name,
                                      companies.*, addresses.*, clients.Client_Approval_Amount_1,
                                      clients.Client_Approval_Amount_2
                              FROM clients
                              LEFT JOIN companies ON clients.Company_ID = companies.Company_ID
                              LEFT JOIN company_addresses ON company_addresses.Company_ID = companies.Company_ID
                              LEFT JOIN addresses ON addresses.Address_ID = company_addresses.Address_ID";

        // set database table for CRUD operations
        $g->table = "clients";

        $g->set_columns($cols);

        // group columns header
        $g->set_group_header( array(
                "useColSpanStyle"=>true,
                "groupHeaders"=>array(
                    array(
                        "startColumnName"=>'Company_ID', // group starts from this column
                        "numberOfColumns"=>6, // group span to next 2 columns
                        "titleText"=>'Company Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'Client_ID', // group starts from this column
                        "numberOfColumns"=>5, // group span to next 2 columns
                        "titleText"=>'Client Information' // caption of group header
                    ),
                    array(
                        "startColumnName"=>'Address1', // group starts from this column
                        "numberOfColumns"=>8, // group span to next 2 columns
                        "titleText"=>"Company's Address" // caption of group header
                    )
                )
            )
        );

        // render grid and get html/js output
        $out = $g->render("Clients");

        $this->render('index',array(
            'out'=>$out,
        ));
	}
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:ClientsController.php

示例13: index


//.........这里部分代码省略.........
         $col['editable'] = true;
         $col["editrules"] = array("required" => true);
         $col['hidden'] = true;
         $cols[] = $col;
         $col = array();
         $col["title"] = "start_date";
         // caption of column
         $col["name"] = "start_date";
         $col["width"] = "350";
         $col['editable'] = true;
         $col["editrules"] = array("required" => true);
         $col['hidden'] = true;
         $cols[] = $col;
         $col = array();
         $col["title"] = "end_date";
         // caption of column
         $col["name"] = "end_date";
         $col['editable'] = true;
         $col["editrules"] = array("required" => true);
         $col['hidden'] = true;
         $col["width"] = "350";
         $cols[] = $col;
         foreach ($titke_cubic as $row) {
             $col = array();
             $col['title'] = "{$row->cubic_value}";
             $col['name'] = "cubic[{$row->cubic_id}]";
             $col['editable'] = true;
             $col["editrules"] = array("number" => true);
             $col["formatter"] = "number";
             $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => '2');
             $col['search'] = false;
             $cols[] = $col;
         }
         $g->set_columns($cols);
         $g->set_actions(array("add" => false, "edit" => true, "bulkedit" => false, "delete" => true, "rowactions" => false, "autofilter" => true, "search" => "simple"));
         $opt['caption'] = "{$head_title}";
         $opt["sortname"] = 'id';
         // by default sort grid by this field
         $opt["sortorder"] = "asc";
         // ASC or DESC
         $opt['rowNum'] = 30;
         $opt["autowidth"] = true;
         $opt["cellEdit"] = true;
         // excel visual params
         $opt["cellEdit"] = true;
         // inline cell editing, like spreadsheet
         $opt["rownumbers"] = true;
         $opt["rownumWidth"] = 30;
         $g->set_options($opt);
         //$e["on_insert"] = array("add_client", null, true);
         $e["on_update"] = array("update_prices", null, true);
         //$e["on_delete"] = array("delete_client", null, true);
         //$e["on_after_insert"] = array("after_insert", null, true); // return last inserted id for further working
         //$e["on_data_display"] = array("filter_display", null, true);
         $g->set_events($e);
         function update_prices(&$data)
         {
             global $_SESSION;
             /*
             These comments are just to show the input param format
             
             $data => Array
             (
             [client_id] => 2
             [params] => Array
             (
开发者ID:arnon22,项目名称:transportcm,代码行数:67,代码来源:pricelist3.php

示例14: index

 public function index()
 {
     //check login
     if ($this->session->userdata('user_name')) {
         $i_rule = $this->session->userdata('user_cizacl_role_id');
         if ($this->cizacl->check_isAllowed($i_rule, 'income')) {
             $grid = new jqgrid();
             $opt["caption"] = $this->lang->line('factory');
             $opt["detail_grid_id"] = "list2";
             $opt["autowidth"] = true;
             // extra params passed to detail grid, column name comma separated
             //$opt["subgridparams"] = "factory_id,factory_code,factory_name";
             $opt["subgridparams"] = "factory_id,factory_code,factory_name";
             $opt["export"] = array("filename" => "my-file", "sheetname" => "test", "format" => "pdf");
             $opt["export"]["range"] = "filtered";
             $grid->set_options($opt);
             $grid->table = "transport_factory";
             $col = array();
             $col["title"] = $this->lang->line('id');
             // caption of column
             $col["name"] = "factory_id";
             // field name, must be exactly same as with SQL prefix or db field
             $col["width"] = "10";
             $col['hidden'] = true;
             $col["editable"] = false;
             $cols[] = $col;
             $col = array();
             $col['title'] = $this->lang->line('factory_code');
             $col['name'] = "factory_code";
             $col["width"] = "35";
             $col["editable"] = false;
             $cols[] = $col;
             $col = array();
             $col['title'] = $this->lang->line('factory_name');
             $col['name'] = "factory_name";
             $col["editable"] = false;
             $cols[] = $col;
             $grid->set_columns($cols);
             $grid->set_actions(array("add" => false, "edit" => false, "delete" => false, "rowactions" => false, "autofilter" => true, "search" => "advance"));
             $out_master = $grid->render("list1");
             // detail grid
             $grid = new jqgrid();
             $opt = array();
             $opt["sortname"] = 'id';
             // by default sort grid by this field
             $opt["sortorder"] = "desc";
             // ASC or DESC
             $opt["height"] = 400;
             // autofit height of subgrid
             $opt["rowNum"] = 10;
             // by default 20
             $opt['rowList'] = array(10, 20, 30, 100);
             $opt["autowidth"] = true;
             $opt["caption"] = $this->lang->line('expense_list');
             $opt["multiselect"] = true;
             $opt['height'] = '350';
             //footer
             $opt["footerrow"] = true;
             $opt["reloadedit"] = true;
             $opt["export"] = array("filename" => "my-file", "sheetname" => "test", "format" => "pdf");
             // export to excel parameters
             $opt["export"]["range"] = "filtered";
             // Check if master record is selected before detail addition
             $opt["add_options"]["beforeInitData"] = "function(formid){ var selr = jQuery('#list1').jqGrid('getGridParam','selrow'); if (!selr) { alert('Please select master record first'); return false; } }";
             $opt["add_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '320');
             $opt["edit_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '320');
             $opt["add_options"]["topinfo"] = "บันทึกรายการซ่อม";
             //$opt["add_options"]["bottominfo"] = "This text is dialog footer text";
             $opt["form"]["position"] = "left";
             $opt["add_options"]["afterShowForm"] = 'function(formid) { jQuery("#ref_number").focus(); }';
             $grid->set_options($opt);
             $grid->set_actions(array("add" => true, "edit" => true, "delete" => true, "rowactions" => true, "export" => false, "autofilter" => true, "search" => "advance"));
             // $id = intval($_GET["rowid"]);
             //$factory_code = $_GET["factory_code"];
             //$company = $_GET["factory_name"];
             //$cid = intval($_GET["factory_id"]);
             if (!empty($_REQUEST)) {
                 $id = intval($_GET["rowid"]);
                 $factory_code = $_GET["factory_code"];
                 $company = $_GET["factory_name"];
                 $cid = intval($_GET["factory_id"]);
                 $this->session->set_userdata('facs_id', $cid);
             }
             $fac_id = $this->session->userdata('facs_id');
             // for non-int fields as PK
             // $id = (empty($_GET["rowid"])?0:$_GET["rowid"]);
             $grid->select_command = "SELECT\n\tid,\n\texpense_date,\n\tfactory_id,\n\texpense.car_id,\n\tcar_number,\n\tref_number,\n\texpense_details,\n\ttotal_amount,\n\texpense.note,\n\t(\n\t\tSELECT\n\t\t\tSUM(total_amount)\n\t\tFROM\n\t\t\texpense\n\t\tWHERE\n\t\t\tfactory_id = {$fac_id}\n\t) AS sumtotals\nFROM\n\t`expense`\nLEFT JOIN transport_cars ON(expense.car_id=transport_cars.car_id)\nWHERE\n\tfactory_id = {$fac_id} AND expense.car_id !=0";
             //$grid->table = "invheader";
             $grid->table = "expense";
             $col = array();
             $col["title"] = $this->lang->line('id');
             // caption of column
             $col["name"] = "id";
             // field name, must be exactly same as with SQL prefix or db field
             $col["width"] = "30";
             $col['hidden'] = true;
             $cols2[] = $col;
             $col = array();
             $col["title"] = $this->lang->line('date');
             $col["name"] = "expense_date";
//.........这里部分代码省略.........
开发者ID:arnon22,项目名称:transportcm,代码行数:101,代码来源:carservice.php

示例15: index


//.........这里部分代码省略.........
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('aver_oil_distance');
         $col["name"] = "aver_oil_distance";
         $col["width"] = "40";
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".");
         $col['align'] = "center";
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('aver_oil_cubic');
         $col["name"] = "aver_oil_cubic";
         $col["width"] = "40";
         $col['align'] = "center";
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".");
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('aver_oil_countOrder');
         $col["name"] = "aver_oil_countOrder";
         $col["width"] = "40";
         $col['align'] = "center";
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".");
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('aver_cubic_countOrder');
         $col["name"] = "aver_cubic_countOrder";
         $col["width"] = "40";
         $col['align'] = "center";
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".");
         $cols[] = $col;
         $g->set_columns($cols);
         //Group
         $g->set_group_header(array("useColSpanStyle" => true, "groupHeaders" => array(array("startColumnName" => 'expenseAmount', "numberOfColumns" => 3, "titleText" => 'รายจ่าย'), array("startColumnName" => 'Count_Order', "numberOfColumns" => 8, "titleText" => $this->lang->line('Other_Average')))));
         $g->set_actions(array("add" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'add'), "edit" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'edit'), "delete" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'delete'), "rowactions" => true, "export" => false, "autofilter" => false, "search" => false));
         $out_master = $g->render("list1");
         if (isset($order_all)) {
             $g2 = new jqgrid();
             //Column Option
             #date
             $col2 = array();
             $col2['title'] = $this->lang->line("date");
             $col2['name'] = "Order_date";
             $col2['width'] = "120";
             $cols2[] = $col2;
             #dpNumber
             $col2 = array();
             $col2['title'] = $this->lang->line("dp_number");
             $col2['name'] = "Dpnumber";
             $col2['width'] = "80";
             $col2['align'] = "left";
             $cols2[] = $col2;
             #FactoryCode
             $col2 = array();
             $col2['title'] = $this->lang->line("factory_code");
             $col2['name'] = "FactoryCode";
             $col2['width'] = "80";
             $col2['align'] = "center";
             $cols2[] = $col2;
             #DistanceCode
             $col2 = array();
             $col2['title'] = $this->lang->line("distance_code");
             $col2['name'] = "DistanceCode";
             $col2['width'] = "80";
开发者ID:arnon22,项目名称:transportcm,代码行数:67,代码来源:cardetail.php


注:本文中的jqgrid::set_columns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。