HiGridpro快速安装向导

HiGridpro快速安装向导。

HiGridpro快速安装向导

系统需求

  1. PHP 5.1以上
  2. PDO (MySQL or PostgreSQL) 例子为mysql

下载安装

本站下载 下载最新版本;

目录结构为:

│  example.php //php文件例子
│  readme.txt   
│  higridsql.sql //示例数据库   
├─example //例子文件夹
│      config.php //数据库设置文件
├─higrid
│  │  HiGrid.php //higrid 主程序
│  │  
│  └─scopbin //加密文件
│          911006.php
├─js //js文件
└─themes //CSS样式文件

安装

  1. 将下载的higrid.版本代码.rar解压缩
  2. 新建数据库,将higridsql.sql导入数据库
  3. 打开config.php设置数据库参数
  4. 将解压缩后的全部文件上传到服务器,任意目录都可
  5. 浏览器中打开example.php查看效果
  6. 增加其他表格只需模仿example文件夹中的php文件修改相应参数即可

注意事项

higrid展示jqgrid需要js和Css进行控制,因此一个显示页面的组成应该是这样的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="http://higrid.net/include/css/higridstock.css" type="text/css" media="screen" charset="utf-8" />
<script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://higrid.net/include/js/higridstock.js" charset="utf-8"></script>
</head>
<body>
<?php include "higrid的php程序文件.php";?>即:example下的文件如chanzhi.php
</body>
</html>

example.php就包含以上代码,只是使用参数ex=?来引用例子。 若您增加的例子如yourgrid.php可以采用path/example.php?ex=yourgrid.php;

以上js和Css采用jqgrid官方的推荐写法,即:

<link rel="stylesheet" type="text/css" media="screen" href="./themes/redmond/jquery-ui-custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="./themes/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="./themes/ui.multiselect.css" />
<style type="text">
   html, body {
   margin: 0;           /* Remove body margin/padding */
   padding: 0;
   overflow: hidden;    /* Remove scroll bars on browser window */
   font-size: 75%;
   }
</style>
<script src="./js/jquery.js" type="text/javascript"></script>
<script src="./js/i18n/grid.locale-cn.js" type="text/javascript"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script src="./js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="./js/jquery-ui-custom.min.js" type="text/javascript"></script>

参数配置说明

defined('HIPATH') || define('HIPATH', dirname(__FILE__).'/');//本语句定义本文件的绝对路径
require_once(HIPATH.'config.php');//config.php保存着数据库连接设置,修改本目录下config.php相关参数

$connhigrid = new PDO(DB_DSN,DB_USER,DB_PASSWORD);//创建一个新的链接
$connhigrid->query("SET NAMES utf8");//设置数据库字符集

$grid = new hgGridRender($connhigrid);//实例化一个对象
//嗨网higrid:执行SQL查询,可自定义SQL语句
$grid->higridSC = 'SELECT * FROM higrid_letter';
$grid->setUserDate('Y-m-d');//自定义年月日显示方式
//也可以$grid->setUserDate('m/d/Y');

$grid->datearray = array('receiveddate','donedate');//'receiveddate'和'donedate'是这个表的两个日期字段

$grid->table = 'higrid_letter';//本数据库的表名称

//自动CRUD操作的key,唯一
$grid->setPrimaryKeyId('letterid');

$grid->dataType = 'json';
$grid->setColModel(); 


//嗨网higrid:隐藏部分列。默认所有列显示
$grid->higridsCP("letterid", array("hidden"=>true));
$grid->higridsCP("doneby", array("hidden"=>true));
$grid->higridsCP("donedate", array("hidden"=>true));

$grid->higridsCP('letterdate', 
        array("label"=>"收发文日期","width"=>"70",'align'=>'center',"formatter"=>"date",
            "formatoptions"=>array("srcformat"=>"Y-m-d", "newformat"=>"Y-m-d"),
            "editoptions"=>array(
            "defaultValue"=>date("Y-m-d"),
            "dataInit"=>
                "js:function(elm){setTimeout(function(){
                    jQuery(elm).datepicker({dateFormat:'yy-mm-dd'});
                    jQuery('.ui-datepicker').css({'font-size':'75%'});
                },200);}")
            ));

//设置每个字段名称,宽度,类型,是否必填?默认字符,筛选过滤选项等等
$grid->higridsCP("lettercontent", array("label"=>"函件内容",'width'=>250,"edittype"=>"textarea", "editrules"=>array("rows"=>10, "cols"=> 100,'width'=>400,"required"=>true)));
$grid->higridsCP('fromunit', array("width"=>"60",'align'=>'center', 'label'=>'发文单位',    "formoptions"=>array("label"=>"发文单位", "elmsuffix"=>"按下拉菜单选择")));
$grid->higridsCP('tounit', array("width"=>"60",'align'=>'center', 'label'=>'收文单位',));
$grid->higridsCP('originid', array("width"=>"80",'label'=>'编号',));
$grid->higridsCP('donedate', array("editoptions"=>array("defaultValue"=>date("Y-m-d"))));
$grid->setSelect("fromunit", array("部门一"=>"部门一","部门二"=>"部门二", "IBM"=>"IBM","google国内"=>"google国内","其他"=>"其他"), false, true, true, array(""=>"默认公司"));
$grid->setSelect("tounit", array("部门一"=>"部门一","部门二"=>"部门二", "IBM"=>"IBM","google国内"=>"google国内","其他"=>"其他"), false, true, true, array(""=>"默认公司"));

//嗨网higrid:post数据处理文件,一般设置本脚本文件路径
$grid->setUrl('./example/letter.php');
//嗨网higrid:表格列属性设置
$grid->higridsGO(array(
    "rownumbers"=>true,//是否显示行号,默认false
    "caption"=>"工作台账",//自定义标题
    "hoverrows"=>true,//鼠标滑动是否变色
    "altRows"=>true,//是否显示斑马表格
    "rowNum"=>20,//默认行数
    "height"=>300,//表格高度
    "rowList"=>array(20,50,100,200),//每页多少数据
    "sortname"=>"letterdate",//排序的字段名称
    "sortable"=>true,//是否启动排序
    'sortorder'=>'desc'));//指定排序方式 
//嗨网higrid:表格列属性设置结束

$grid->navigator = true;//导航是否显示

//页面编辑设置true可用;false不显示、不可用
$grid->higridsNO('navigator', array("excel"=>true,"add"=>true,"edit"=>false,"del"=>false,"view"=>true, "refresh"=>true,"search"=>true,"pdf"=>false));

//增加数据对话框个性化
$grid->higridsNO('add',array("width"=>500,"height"=>300,"dataheight"=>"auto",
"closeAfterAdd"=>true,"reloadAfterSubmit"=>true));//添加数据完后关闭对话框
//编辑数据对话框个性化
$grid->higridsNO('edit',array("width"=>500,"height"=>300,"dataheight"=>"auto",
"closeAfterEdit"=>true,"reloadAfterSubmit"=>true,"editCaption"=>"编辑数据","bSubmit"=>"更新"));

//最终表格的table div id,pager div id
//本页的html代码<table id='cd_lettergrid'></table><div id='cd_letterpager'></div>
$grid->higridOP('#cd_lettergrid','#cd_letterpager',true, null, null, true,true);
$connhigrid = null;//关闭连接

注册用户有问题请联系我们

随机文章 Random Posts