Simple grid with basic functions.
Пример использования render_data для сохранения переменных, с которыми были иницилазирована таблица.
higrid.net嗨网提供电子表格、在线图形等互联网开发及运营技术,提供相关资料及软件下载,分享奇趣网络时事评论!欢迎访问。


部分内容为俄文,higrid计划翻译一下。敬请期待!

php代码和js代码请点击tab查看。
<?php

class jqRenderData extends jqGrid
{
    protected function init()
    {
        $this->options = array(
            'rowNum' => 10,
        );

        #Set table
        $this->table = 'tbl_order_item';

        $this->query = "
			SELECT {fields}
			FROM tbl_order_item oi
				JOIN tbl_order o ON (oi.order_id=o.id)
				JOIN tbl_books b ON (oi.book_id=b.id)
			WHERE {where}
		";

        $this->cols_default = array('align' => 'center');

        #Set columns
        $this->cols = array(

            'id' => array('label' => 'ID',
                'db' => 'oi.id',
                'hidden' => true,
            ),

            'book_id' => array('label' => 'Book ID',
                'db' => 'oi.book_id',
                'width' => 10,
            ),

            'book_name' => array('label' => 'Book name',
                'db' => 'b.name',
                'width' => 40,
                'align' => 'left',
            ),

            'price' => array('label' => 'Price',
                'db' => 'oi.price',
                'width' => 15,
            ),

            'quantity' => array('label' => 'quantity',
                'db' => 'oi.quantity',
                'width' => 12,
            ),
        );

        #Set essential condition
        $this->where[] = 'o.customer_id = ' . intval($this->input['customer_id']);
    }
}
<script>
    <?= $rendered_grid ?>
</script>