Download the PHP package djuki/jqgrider without Composer

On this page you can find all versions of the php package djuki/jqgrider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jqgrider

jqGrider

Introduction

jqGrider is PHP library for generating jqGrid without typing JavaScript code. I created jqGrider for admin part of my applications. I wanted to without much effort present my database tables and datas into ajax grid.

jqGrid is at this moment most complete full-stack javascript grid. At this moment jqGrider supotring only basic and most needed functionality of jqGrid.

With jqGrider you can:

Code examples

basic usage of jgGrider

Your main action presenting grid

public function action_grid()
{
    $view = $this->app->forge('View', 'grid');

    $grid = new \JqGrider\Grid(\JqGrider\Grid::DATA_TYPE_JSON);
    $grid
    ->addColumn('ID', 'id', 200)
    ->addColumn('Full Name', 'name', 450)
    ->setUrl('http://localhost/fuelphp2/public/index.php/welcome/grid_data');

    $view->set('grid_js', $grid->getJavaScriptCode(), false);

    return $view;
}

Your view with grid

<?=$grid_js?>

Ajax action which will return grid data with ajax call

public function action_grid_data()
{

    $grid = new \JqGrider\Grid(\JqGrider\Grid::DATA_TYPE_JSON);
    $grid
    ->setRepository(new \App\Model\User())
    ->addColumn('ID', 'id', 200)
    ->addColumn('Full Name', 'name', 450);

    $grid->printRespositoryData();
}

User model need to implement IGridRepository and define two methods getData and countDataRows.

getData can return object with data, and it must have properties like column names. Also it can returna array and key names also must be named as column names.

countDataRows will count data rows considering conditions.

Object Conditions representing search query, and it wil help you to generate database query to calculate rows in search conditions.

namespace App\Model;

use JqGrider\Data\IGridRepository;
use JqGrider\Data\Conditions;

class User implements IGridRepository
{
protected $pdo;

public function __construct()
{   
    // Connect on database with pdo object for example
}

public function getData(Conditions $dataConditions)
{
    $offset = $dataConditions->page == 1 ? 0 : $dataConditions->rowsLimit * ($dataConditions->page - 1);
    $sql = 'SELECT id, name FROM user ';

    if ($dataConditions->search === 'true')
    {
        $sql .= ' WHERE '.$dataConditions->searchCondition;
    }

    $sql .=' ORDER BY '.$dataConditions->sortBy.' '.$dataConditions->sort;

    $sql .= ' LIMIT '.$dataConditions->rowsLimit.' OFFSET '.$offset;

    $statement = $this->pdo->prepare($sql, array(\PDO::ATTR_CURSOR => \PDO::CURSOR_FWDONLY));
    @$statement->bindParam(':grid_search_string',$dataConditions->searchString);

    if ($statement->execute())
    {
        return $statement->fetchAll(\PDO::FETCH_CLASS);
    }
}

public function countDataRows(Conditions $dataConditions)
{
    $sql = 'SELECT count(id) FROM user';
    if ($dataConditions->search === 'true')
    {
        $sql .= ' WHERE '.$dataConditions->searchCondition;
    }       
    if ($result = $this->pdo->query($sql))
    {
        return $result->fetchColumn();
    }       
}
}

Using anonymous functions

Anonymous function can be added into Column object to change column content.

        $nameFunction = function ($content)
        {
            return 'Member name is: '.$content;
        };

        $grid = new Grid(Grid::DATA_TYPE_JSON);
        $grid->addColumn('Full Name', 'name', 450, $nameFunction);

Using local data for grid

public function action_grid()
{
    $view = $this->app->forge('View', 'grid');

    $grid = new Grid(Grid::DATA_TYPE_JSON);
    $grid
    ->addColumn('ID', 'id', 200)
    ->addColumn('Full Name', 'name', 450);

    $grid->setLocalData(array(
        array('id' => 4, 'name' => 'William Harrison'),
        array('id' => 5, 'name' => 'Erick Hawkins'),
        array('id' => 6, 'name' => 'Gene Autry'),
    ));

    $view->set('grid_js', $grid->getJavaScriptCode(), false);
    return $view;
}

All versions of jqgrider with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package djuki/jqgrider contains the following files

Loading the files please wait ....