Skip to content

# Setup

### Requirements

On server side, we need:

1) A Webserver running PHP v5.6+ (v5.6 and onwards)

2) Database server (MySql, SQL Server, Oracle, SQLite or any other you use)

On client side, we have tested it on famous browsers of Windows, MacOS and Linux.

### Installing Demos using Web Installer

1) Extract the downloaded product archive in web root. e.g. www/gridphp

2) Open it in browser to run installer. e.g. http://localhost/gridphp and following the intallation steps.

### Installing Demos Manually

1) Execute "demos/sample-db/database-mysql.sql" on a Mysql Database. It will create 'griddemo' database. For SQL Server installation same process can be followed using database-mssql.sql file.

2) Place all files in a directory on the web server. e.g. ".../www/gridphp/"

3) Rename config.sample.php to config.php, and update database config. e.g.

    define("PHPGRID_DBTYPE","mysqli");
    define("PHPGRID_DBHOST","localhost");
    define("PHPGRID_DBUSER","root");
    define("PHPGRID_DBPASS","");
    define("PHPGRID_DBNAME","griddemo");

    // It will work in normal cases, unless you change lib folder location
    define("PHPGRID_LIBPATH",dirname(__FILE__).DIRECTORY_SEPARATOR."lib".DIRECTORY_SEPARATOR);

4) Run the product demos in browser. e.g. http://localhost/gridphp/index.php

### Integration in your Project

To integration in your app, copy 'lib' folder to your project. You need to consider 3 things.

1) Set DB config

    $db_conf = array();
    $db_conf["type"] = "mysqli";
    $db_conf["server"] = PHPGRID_DBHOST; // or you mysql ip
    $db_conf["user"] = PHPGRID_DBUSER; // username
    $db_conf["password"] = PHPGRID_DBPASS; // password
    $db_conf["database"] = PHPGRID_DBNAME; // database

    // pass connection array to jqgrid()
    $g = new jqgrid($db_conf);

2) The folder `../../lib` will be replaced by path where you place `lib` folder (if changed)

    <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>
    <script src="../../lib/js/jquery.min.js" type="text/javascript"></script>
    <script src="../../lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
    <script src="../../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
    <script src="../../lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>

3) Update include path where you place `lib/inc/` folder (if changed)

    include("../../lib/inc/jqgrid_dist.php");
    $g = new jqgrid($db_conf);

### Upgrading from older version

To upgrade you just need to update files of two folder `lib/inc` & `lib/js`.

- Take a backup of current `lib/inc` & `lib/js` folders.
- Replace `lib/inc` & `lib/js` from the new version archive to your existing datagrid implementation.
- You may need to clear browser cache to remove the effect of previous JS and CSS files.

Same process applies when upgrading from free version to full version.

### Upgrading to v2.8 from previous versions

If you are using custom toolbar buttons, there a slight change required after upgrade.

Previous implementation is to have JS code in following way:

    jQuery("#list1").jqGrid('navButtonAdd',"#list1_pager",{...});
    jQuery("#list1").jqGrid('navButtonAdd',"#list1_pager",{...});

In v2.8 and onwards, move this code inside a setTimeout() delay of 10ms:

    setTimeout(()=>{

        jQuery("#list1").jqGrid('navButtonAdd',"#list1_pager",{...});
        jQuery("#list1").jqGrid('navButtonAdd',"#list1_pager",{...});

    },10);