Home php教程 php手册 jqGrid 导出excel表格代码(php+jqgrid实例)

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

Jun 13, 2016 am 11:24 AM
excel code Example Export sheet

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



 


    jqgrid php demo
   
   
   
   
   
   
   
   
   
   
 
 
     

         
     

     

     
  

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;
?>

 


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Steps to adjust the format of pictures inserted in PPT tables Steps to adjust the format of pictures inserted in PPT tables Mar 26, 2024 pm 04:16 PM

Steps to adjust the format of pictures inserted in PPT tables

How to filter more than 3 keywords at the same time in excel How to filter more than 3 keywords at the same time in excel Mar 21, 2024 pm 03:16 PM

How to filter more than 3 keywords at the same time in excel

What should I do if the frame line disappears when printing in Excel? What should I do if the frame line disappears when printing in Excel? Mar 21, 2024 am 09:50 AM

What should I do if the frame line disappears when printing in Excel?

How to change excel table compatibility mode to normal mode How to change excel table compatibility mode to normal mode Mar 20, 2024 pm 08:01 PM

How to change excel table compatibility mode to normal mode

How to set superscript in excel How to set superscript in excel Mar 20, 2024 pm 04:30 PM

How to set superscript in excel

Where to set excel reading mode Where to set excel reading mode Mar 21, 2024 am 08:40 AM

Where to set excel reading mode

How to use the iif function in excel How to use the iif function in excel Mar 20, 2024 pm 06:10 PM

How to use the iif function in excel

How to read excel data in html How to read excel data in html Mar 27, 2024 pm 05:11 PM

How to read excel data in html

See all articles