Skip to content

Commit

Permalink
Added better Support for Nodetypes and Icons
Browse files Browse the repository at this point in the history
  • Loading branch information
kasoft committed Sep 7, 2018
1 parent 0970f0e commit 2ce9e62
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
19 changes: 17 additions & 2 deletions JsTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class JsTree extends Widget
* be also used to set allwoed/disallowed functions (child creation, new nodes, etc.)
* This is not implemented at the Moment!
*/
public $modelPropertyType = NULL; // Column Name of the Position attribute e. g. 'position'
public $modelPropertyType = NULL; // Column Name of the type Attribute og Node e. g. 'type'

/*
* @var string Text for the initial name of a new node. As a new node will be craeted
Expand Down Expand Up @@ -150,7 +150,19 @@ public function init() {
"max_children" => -1,
"max_depth" => -1,
"valid_children" => -1,
"icon" => "glyphicon glyphicon-question-sign"
"icon" => "glyphicon glyphicon-list-alt"
],
"online" => [
"max_children" => -1,
"max_depth" => -1,
"valid_children" => -1,
"icon" => "glyphicon glyphicon-ok-sign"
],
"offline" => [
"max_children" => -1,
"max_depth" => -1,
"valid_children" => -1,
"icon" => "glyphicon glyphicon-minus-sign"
],
];
}
Expand Down Expand Up @@ -197,6 +209,9 @@ public function init() {

if (empty($this->modelPropertyPosition))
$this->modelPropertyPosition = "sort";

if (empty($this->modelPropertyType))
$this->modelPropertyType = "type";

if (empty($this->modelStandardName))
$this->modelStandardName = "New Entry";
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,23 @@ The preferred way to install this extension is through [composer](http://getcomp
Either run

```
php composer.phar require --prefer-dist kasoft/yii2-jstree "1.0.6"
php composer.phar require --prefer-dist kasoft/yii2-jstree "1.0.7"
```

or add

```
"kasoft/yii2-jstree": "1.0.6",
"kasoft/yii2-jstree": "1.0.7",
```

to the require section of your `composer.json` file.

Latest News
-----

Version 1.0.7
- Added modelPropertyType with default value + online/offline glyphicons as default

Version 1.0.6
- Fixed a Problem with Yii 2.0.14, because of a diffrent Error Handling, the Tree wasn't displayes
- REQUEST check in Controller isn't needed any more
Expand Down

0 comments on commit 2ce9e62

Please sign in to comment.