From e877695eb27e01949315ca2de4e3385d2ed985d6 Mon Sep 17 00:00:00 2001 From: Leandro Gehlen Date: Mon, 24 Apr 2017 10:53:39 -0300 Subject: [PATCH] Close #13, #14: Added docs about how to add extra resource files --- README.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bab72d0..1aa6487 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ or add to the require section of your `composer.json` file. -## How to use +## Usage **Model** @@ -112,4 +112,32 @@ use leandrogehlen\treegrid\TreeGrid; ]); ?> ``` +## Adding resources + +When is necessary to add other resource files, then should be used the [Dependency Injection](http://www.yiiframework.com/doc-2.0/guide-concept-di-container.html#registering-dependencies) concept. + +To use the `saveState` option it's necessary to add `jquery.cookie.js`. + +```php +//config/web.php + +$config = [ + 'id' => 'my-app', + 'components' => [ + ... + ] + ... +] + +Yii::$container->set('leandrogehlen\treegrid\TreeGridAsset',[ + 'js' => [ + 'js/jquery.cookie.js', + 'js/jquery.treegrid.min.js', + ] +]); + +return $config; +``` + +