Skip to content

Commit 2aa2034

Browse files
committed
update Readme
1 parent 1e07ee4 commit 2aa2034

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
yii2-bootstrap-tree
22
===================
3-
Виджет основыный на [bootstrap-treeview](https://github.com/patternfly/patternfly-bootstrap-treeview)
3+
Widget for [bootstrap-treeview](https://github.com/patternfly/patternfly-bootstrap-treeview)
44

55
Installation
66
------------
@@ -28,17 +28,52 @@ Usage
2828
Once the extension is installed, simply use it in your code by :
2929

3030
```php
31+
32+
<?php
33+
// Example of data. $items structure https://github.com/jonmiles/bootstrap-treeview#data-structure
34+
$items = [
35+
[
36+
'text' => 'Node 1'
37+
'icon' => "glyphicon glyphicon-stop",
38+
'selectedIcon' => "glyphicon glyphicon-stop",
39+
'href' => "#node-1",
40+
'selectable' => true,
41+
'state' => [
42+
'checked' => true,
43+
'disabled' => true,
44+
'expanded' => true,
45+
'selected' => true
46+
],
47+
'tags' => ['available'],
48+
...,
49+
'nodes'=>
50+
[
51+
...
52+
]
53+
],
54+
[
55+
'text' => 'Folder 2',
56+
'nodes' => [
57+
['text' => 'Node 2.1'],
58+
['text' => 'Node 2.2']
59+
]
60+
]
61+
];
62+
?>
63+
3164
<?= \lesha724\bootstraptree\TreeView::widget([
3265
'htmlOptions'=>[
3366
'id'=>'treeview-tabs'
3467
],
3568
'options'=>[
36-
'data'=>$items,
69+
//https://github.com/patternfly/patternfly-bootstrap-treeview#options
70+
'data'=>$items, // $items structure https://github.com/patternfly/patternfly-bootstrap-treeview#data-structure
3771
'enableLinks'=>true,
3872
'showTags'=>true,
3973
'levels'=>3
4074
],
4175
'events'=>[
76+
//https://github.com/patternfly/patternfly-bootstrap-treeview#events
4277
'onNodeSelected'=>'function(event, data) {
4378
// Your logic goes here
4479
alert(data.href);

0 commit comments

Comments
 (0)