Download the PHP package fgsl/eyedatagrid without Composer
On this page you can find all versions of the php package fgsl/eyedatagrid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fgsl/eyedatagrid
More information about fgsl/eyedatagrid
Files in fgsl/eyedatagrid
Package eyedatagrid
Short Description Display data from a database in a sortable table
License BSD-2-Clause
Homepage https://github.com/fgsl/eyedatagrid
Informations about the package eyedatagrid
EyeDataGrid
Based on version 1.0 of class created by Mike Frank http://www.eyesis.ca Former source code: https://www.phpclasses.org/package/4951-PHP-Display-data-from-a-database-in-a-sortable-table.html
This component was built because former EyeDataGrid has not update since 2008 and presents fatal errors in current PHP environments.
About
This class can be used to display data from an SQL database in a sortable HTML table. It can execute a given SQL query and generate HTML and Javascript to display the data in an HTML table. The table listing can be sorted by clicking on the column header titles. Data grid tables can also be displayed using Ajax. Its creator, Mike, was not satisfied with available PHP data grid controls. He uses data grids on every web site that he developes. According him, they're great for displaying all kinds of data. He argues that developed his datagrid to suit all his needs and more.
Features
- Filtering and searching capabilities
- Ability to change column headers
- Capable of displaying images
- Automatic row paging
- Row selection
- Supports MySQL database
- Hide columns
- Sort columns
- Customizable look and feel through CSS
- Can handle large data sets
- Ability to add controls
- Checkbox support
- Specify column format types (such as percent, dollars, etc)
- Much more...
Files
Eyedatagrid.php
The main datagrid class
EyeMySQLAdap..php
Mysql wrapper class created by Mike in former project - an improvement is replacing it with another one
*ex.php** -Example datagrid
Create a file local.php in config folder from local.inc.php template and fill with database access parameters.
*ex.png**
Image of the example
sample data.sql
Sample data for playing around with (from examples).
Create a database from this script for running samples.
table.css
-The style layout for the datagrid table
Placeholder Variables
What is a placeholder in the datagrid control?
- A placeholder is a just the same as a variable. It is a name and references a column in a particular row.
- For exampe; lets say you had a Pets table with PetName, PetAge and PetComment columns.
- You can reference other columns in the PetComment by placing percent symbols (%) around the column name you are specifying.
- If the primary key is set during the setQuery method, you can use %_P% as a placeholder for the table's primary key. Where can I use this?
- This can be on the database or scripted.
- This can be used in column types criteria and criteria_2 param. Look below on TYPE_IMAGE and TYPE_CUSTOM for more examples.
Column Types and Usage
A quick overview of the available column types.
TYPE_ONCLICK
Sets a "onclick" call on a cell value.
e.g:
$db->setColumnType('FirstName', EyeDataGrid::TYPE_ONCLICK, "alert('Hello?')");
TYPE_HREF
Sets a href link on a cell value.
e.g:
$db->setColumnType('FirstName', EyeDataGrid::TYPE_HREF, "http://www.google.com");
TYPE_DATE
Format a date.
e.g:
TYPE_IMAGE
Changes a column's values to a image.
e.g:
TYPE_ARRAY
Maps a value to a key in an array
TYPE_CHECK
Converts a cell to a checkmark when the value is "1", "true", "yes" or value matches 3rd passed value.
e.g:
TYPE_PERCENT
Converts a value to a percent as a whole number.
e.g:
TYPE_DOLLAR
Converts a value to the a currency. Always rounded to 2 decimal places.
e.g:
TYPE_CUSTOM
Convert value to a custom value.
e.g:
TYPE_FUNCTION
Sends a value (or values) to a user specified function.
e.g: