Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andkon13/yii2dynatree
https://github.com/andkon13/yii2dynatree
js php tree yii
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/andkon13/yii2dynatree
- Owner: andkon13
- Created: 2014-08-28T11:51:50.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-26T14:43:01.000Z (over 7 years ago)
- Last Synced: 2024-10-16T12:21:16.441Z (20 days ago)
- Topics: js, php, tree, yii
- Language: JavaScript
- Size: 180 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
yii2dynatree
============
docs:
http://wwwendt.de/tech/dynatree/
demo:
http://andkon.bl.ee/index.php?r=storeinstall:
php composer.phar require "andkon/yii2dynatree": "dev-master"
Как использовать/How to use
Model:
need attributes:
id - primary key
parent_id - FK to id
sort - INT order in tree
name - STRING as label
you can override the field names
attribs
$pkField
$parentField
$sortFieldController:
class UnitController extends Controller
{
...
public function actions()
{
$actions = parent::actions();
$actions['moveintree'] = 'andkon\yii2dynatree\actions\MoveInTree';
// or
$actions['moveintree'] = [
'class' => andkon\yii2dynatree\actions\MoveInTree',
'sortField' => 'order', // override field name
];return $actions;
}
...
}Widget:
class Tree extends \andkon\yii2dynatree\Tree
{
public function init()
{
parent::init();
$this->functions['onClick'] = 'function (node, event) {
unit.showDetal(node.data.key);
}';
}
}View:
echo \app\pathToWidget\Tree::widget(
[
'id' => 'treeId',
'isAjax' => true, // true for use ajax load widget (in dialog|popup etc.) or false for standart render
'ajaxUrl' => Yii::$app->getUrlManager()->createUrl('/pathToController/moveintree'),
'model' => $model,
]
);