PHP code example of fgsl / eyedatagrid

1. Go to this page and download the library: Download fgsl/eyedatagrid library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fgsl / eyedatagrid example snippets


$db->setColumnType('Birthday', EyeDataGrid::TYPE_DATE, "M d, Y", true); // Converts to a timestamp and then to the formatted date
$db->setColumnType('Birthday', EyeDataGrid::TYPE_DATE, "M d, Y"); // Converts formatted date from a timestamp

$db->setColumnType('Photo', EyeDataGrid::TYPE_IMAGE, "/images/photos/%LastName%.png");

$db->setColumnType('Gender', EyeDataGrid::TYPE_ARRAY, array('f' => 'Female', 'm' => 'Male'));

$db->setColumnType('Single?', EyeDataGrid::TYPE_CHECK);
$db->setColumnType('Single?', EyeDataGrid::TYPE_CHECK, 'legs');

$db->setColumnType('Score', EyeDataGrid::TYPE_PERCENT); // Value is already in percent
$db->setColumnType('Score', EyeDataGrid::TYPE_PERCENT, true); // Value is converted from decimal format when 3rd param is true
$db->setColumnType('Score', EyeDataGrid::TYPE_PERCENT, true, array('Back' => 'red', 'Fore' => 'black')); // Adds bars whose width represents the percent, colors are specified as 'Back' and 'Fore'

$db->setColumnType('Price', EyeDataGrid::TYPE_DOLLAR);`

$db->setColumnType('School', EyeDataGrid::TYPE_CUSTOM, 'I go to %CollegeName% in %City%, %Province%'); // Converts a cell to "I go to..". Placeholders are replaced with the value in that row's column

$db->setColumnType('Password', EyeDataGrid::TYPE_FUNCTION, 'md5', '%Password%'); // Value is sent to the md5 function and return is printed in the cell
$db->setColumnType('Password', EyeDataGrid::TYPE_FUNCTION, 'make_hash', '%Password%'); // Value is sent to the make_hash user function and return is printed in the cell
$db->setColumnType('Password', EyeDataGrid::TYPE_FUNCTION, 'generate_key', array('%Username%', '%Password%')); // To pass multiple params to the user function use an array