PHP Datagrid Component

IMPORTANT NOTE:

UPDATE (2nd May, 2013): New Feature Updates
New features include Autocomplete option for fast data lookup, Column based formatting, Clone Records, Twitter Bootstrap Integration, Grouping Headers and File Upload Option. Visit official  website for more www.phpgrid.org.

UPDATE (4th Feb, 2013): Released version v1.4.8 (for premium customers)
New featured examples include HTML / WYSIWYG editor integration, FancyBox integration, Loading Grid from phpArray, Conditional formatting, Conditional Data display, Controlling multiple detail grids from master, Server side validation, Custom client side validation, MySQLi support added. Visit official  website for more www.phpgrid.org.

jqGrid is an Ajax-enabled JavaScript control that provides solutions for representing and manipulating tabular data on the web. Since the grid is a client-side solution loading data dynamically through Ajax callbacks, it can be integrated with any server-side technology, including PHP.

Here i’ve made a self-written PHP Ajax Data Grid component using JQGrid (based on JQuery). This library can generate fully featured CRUD application in record time.

include("jqgrid.php");

$g = new jqgrid();
$grid["caption"] = "My Sample Grid"; // set grid customizable params
$g->set_options($grid);
$g->table = "tags"; // db table for CRUD operations.

// You can also specify SQL query for displaying data (download code with examples)
// $g->select_command = "select f1,f2,f3 from tags";

$out = $g->render("my_grid_1"); // render grid

... and in HTML after including JS files ...

<div>
<?php echo $out?>
</div>

This code will result in fully functional Jquery Grid (JqGrid) with …

  • Add
  • Edit
  • Delete
  • Search
  • Auto-filter
  • Sort
  • Pagination
  • Export
  • Multilevel Subgrid option (n-level)
  • Events for Add/Update/Delete Custom implementation
  • Multiple Themes (ThemeRoller)
  • and almost all features available for FREE … which cost $299 on official commercial license.
  • No time limitation

* Bold features are added in update of 5th October.

This component is highly customizable using option parameters, which can be added as needed.

php-ajax-datagrid-jqgrid

UPDATE: 5th October, 2010

Following features are now incorporated in free version …

1. Sub-Grid/ Master Detail support

And it is available with all main operations … like search/add/edit/delete/sort/paging etc. You can have multi-level subgrids.

JQGrid Subgrid & Master Detail Example
JQGrid Subgrid & Master Detail Example

2. Custom Events Support

Now you can write you own custom implementations on UPDATE / INSERT / DELETE.

E.g. code …

// params are array(<function-name>,<class-object> or <null-if-global-func>,<continue-default-operation>)

$e[“on_insert”] = array(“add_client”, null, false);

$e[“on_update”] = array(“update_client”, null, true);

$e[“on_delete”] = array(“delete_client”, null, true);

$grid->set_events($e);

UPDATE: 2nd November, 2010

Several fixes are incorporated in latest version. Please get your latest copy.

* Support for formatters e.g.

$col[“formatter”] = “date”; // format as date

$col[“formatoptions”] = array(“srcformat”=>’Y-m-d’,”newformat”=>’d/m/Y’); // format as date

* Cell editing navigation support,  like excel

* Table alias fields are fixed

* Enabled support for GROUP BY custom query

* Export excel fix for ? based url

Free version has no time limitation, but source code is encrypted or encoded.

Need Customization or Technical Support?

- You can get complete source code and subscription for priority support and updates from this link

Download free version with usage example

UPDATE (15th Jan, 2013): New featured examples include Custom toolbar button, Export to CSV, Date Time picker control, Open grid in edit mode by default, Added more themes (24 total), Add Data Grouping example + updated documentation. Visit official  website for more www.phpgrid.org.

Product now got a new home ‘www.phpgrid.org‘ with a new version 1.4.6. Refer this site for all future updates.

Comments
  1. Charfeddine says:

    hi ,
    I want to add Export option to my web site please what shoud i do ????

  2. mihai jiros says:

    i interesting the full code for multi-level subgrids””
    i need to make a database with:
    id_company, company, vat nr, adres, name, email etc
    end id_company, employers, cnp, date, adres, tel, nr_social etc.
    and i need to print, end generate pdf file
    for company a need to make users to access this information
    for a each company i will select an employers and for each employer to print diferent reports
    i want to pay this 50& for the program

    best regardes
    mihai jiros
    jiros_mihai@tectron.ro

  3. Does your grid with full source code support or can be run on sql server database?

  4. kidsofts says:

    how to attach a new query

    $g->select_command = “SELECT * FROM (SELECT i.id, invdate , c.name,

    if(isset($_post[‘txtClientID’]))
    {
    $var = $_post[‘txtClientID’];
    $g->select_command = “SELECT * FROM (SELECT i.id, invdate , c.name,
    i.note, i.total, IF(i.closed=’No’,’Not Booked’,IF(i.closed=’Yes’,’Yes it is Booked’,’n/a’)) as closed FROM invheader i
    INNER JOIN clients c ON c.client_id = i.client_id and c.clint_id “. $var.”) o”;
    }
    else
    {
    $g->select_command = “SELECT * FROM (SELECT i.id, invdate , c.name,
    i.note, i.total, IF(i.closed=’No’,’Not Booked’,IF(i.closed=’Yes’,’Yes it is Booked’,’n/a’)) as closed FROM invheader i
    INNER JOIN clients c ON c.client_id = i.client_id) o”;
    }

    how can i attach a query data from a form

  5. raja says:

    how to run in the grid

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s