PHP头条
热点:

jqGrid 导出excel表格代码(php+jqgrid实例)


jqgrid 导出excel表格代码(php教程+jqgrid实例)
require_once '../../../tabs.php';
?>

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
<html>
  <head>
    <title>jqgrid php demo</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css教程" media="screen" href="../../../themes/redmond/jquery-ui-1.7.1.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="../../../网页特效/jquery.网页特效" type="text/网页特效"></script>
    <script src="../../../js/i18n/grid.locale-en.js" type="text/网页特效"></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-1.7.2.custom.min.js" type="text/javascript"></script>
  </head>
  <body>
      <div>
          <?php include ("grid.php");?>
      </div>
      <br/>
      <?php tabs(array("grid.php"));?>
   </body>
</html>

php代码

<?php
require_once '../../../jq-config.php';
// include the jqgrid class
require_once abspath."php/jqgrid.php";
// include the driver class
require_once abspath."php/jqgridpdo.php";
// connection to the server
$conn = new pdo(db_dsn,db_user,db_password);
// tell the db that we use utf-8
$conn->query("set names utf8");

// create the jqgrid instance
$grid = new jqgridrender($conn);
// write the sql query
$grid->selectcommand = 'select orderid, orderdate, customerid, freight, shipname from longorders';
// set the ouput format to json
$grid->datatype = 'json';
// let the grid create the model
$grid->setcolmodel();
// set the url from where we obtain the data
$grid->seturl('grid.php');
$grid->optimizesearch = true;
// set some grid options
$grid->setgridoptions(array("rownum"=>100,"sortname"=>"orderid","height"=>150));
// change some property of the field(s)
$grid->setcolproperty("orderdate", array(
    "formatter"=>"date",
    "formatoptions"=>array("srcformat"=>"y-m-d h:i:s","newformat"=>"m/d/y"),
    "search"=>false
    )
);
// enable toolbar searching
$grid->toolbarfilter = true;
$grid->setfilteroptions(array("stringresult"=>true));
// enjoy
$grid->rendergrid('#grid','#pager',true, null, null, true,true);
$conn = null;
?>

 

www.phpzy.comtrue/php/11934.htmlTechArticlejqGrid 导出excel表格代码(php+jqgrid实例) jqgrid 导出excel表格代码(php教程+jqgrid实例) require_once '../../../tabs.php'; ? !doctype html public -//w3c//dtd xhtml 1.0 strict//en http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict....

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐