Yii2 wrapper for a powerful ajax-enabled grid jqGrid jQuery plugin.
Installation ¶
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist "himiklab/yii2-jqgrid-widget" "*"
or add
"himiklab/yii2-jqgrid-widget" : "*"
to the require section of your application's composer.json
file.
Usage ¶
- Add action in the controller (optional), for example:
use himiklab\jqgrid\actions\JqGridActiveAction;
public function actions()
{
return [
'jqgrid' => [
'class' => JqGridActiveAction::className(),
'model' => Page::className(),
'columns' => ['title', 'author', 'language']
],
];
}
- View's example
use himiklab\jqgrid\JqGridWidget;
<?= JqGridWidget::widget([
'requestUrl' => 'admin/jqgrid',
'gridSettings' => [
'colNames' => ['Title', 'Author', 'Language'],
'colModel' => [
['name' => 'title', 'index' => 'title', 'editable' => true],
['name' => 'author', 'index' => 'author', 'editable' => true],
['name' => 'language', 'index' => 'language', 'editable' => true]
],
'rowNum' => 15,
'autowidth' => true,
'height' => 'auto',
],
'pagerSettings' => [
'edit' => true,
'add' => true,
'del' => true,
'search' => ['multipleSearch' => true]
],
'enableFilterToolbar' => true
]); ?>
Sound good.
as title.
Setting up with Yii 2
Hi,
I just wanted how you set this up with the application.
I have got everything working up to the point where the grid shows, but no data is showing. What is confusing me is where is the data supposed to come from? Can I have Jqgrid read directly from my model, or should it only read from a Json object?
For example, how do I set it up to read directly from the database located in phpmyadmin on my local server?
Kind Regards
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.