stratoss / yii2-gridster
Gridster.js widget for Yii2
Package info
github.com/stratoss/yii2-gridster
Type:yii2-extension
pkg:composer/stratoss/yii2-gridster
v2.0.7
2016-01-29 10:19 UTC
Requires
- bower-asset/gridster.js: *
- bower-asset/jquery: *
- yiisoft/yii2: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This extension provides the Gridster.js integration for the Yii2 framework.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist stratoss/yii2-gridster "*"
or add
"stratoss/yii2-gridster": "*"
to the require section of your composer.json file.
Usage
Use Gridster.js as any other other Yii2 widget.
use stratoss\gridster\Gridster;
$gridster = Gridster::begin([ 'options'=>['class'=>'gridster'], 'clientOptions'=>[ 'widget_margins'=> [10, 10], 'widget_base_dimensions'=> [140, 140], 'autogrow_cols'=> false, 'resize'=>['enabled'=>true] ] ]);?> <?= $gridster->beginWidget([ 'data-row'=>"1", 'data-col'=>"1", 'data-sizex'=>"5", 'data-sizey'=>"2", ]); ?> <header>Some text</header> The widget content <?=$gridster->endWidget();?> <?=$gridster->beginWidget([ 'data-row'=>"1", 'data-col'=>"1", 'data-sizex'=>"4", 'data-sizey'=>"1", ]); ?> <header>Some other text</header> The other widget content <?=$gridster->endWidget();?> <?php Gridster::end();
You can also use Gridster.js in the JavaScript layer of your application. To achieve this, you need to include Gridster as a dependency of your Asset file.
public $depends = [ ... 'stratoss\gridster\GridsterAsset', ... ];