Closed scmember closed 5 years ago
Since treemanager
is a module - the controller and action routes will be module specific prefixed by module name (if you use a relative route without preceding forward slash). This is more an Yii2 URL configuration. You need to use the absolute right action with a preceding forward slash in such cases:
For example you should change and correct your button action to following:
<?= Html::a('Action', ['/controller/action', 'id' => $node->node_id], ['class' => 'btn btn-info']) ?>
NOTE the preceding forward slash /
before the controller (assuming the controller is in your root app.
damn it's so simple!
Thank you very much!
Hello!
Added a button to root node which implements an action, just like this:
<?= Html::a('Action', ['controller/action', 'id' => $node->node_id], ['class' => 'btn btn-info']) ?>
When I open tree manager window for a first time, the first root node is selected by default, and the button link of a node looks like: http://server/index.php?r=controller%2Faction&id=1 It's ok.
But if I select any other root node (for eample 35), the button link of this node looks like: http://server/index.php?r=treemanager%2Fcontroller%2Faction&id=35
Then if I try to return to the first root node, its button link changes to http://server/index.php?r=treemanager%2Fcontroller%2Faction&id=1
What is the right way to set a route for the button? Thanks