kartik-v / yii2-tree-manager

An advanced tree management module using nested sets for Yii 2.
http://demos.krajee.com/tree-manager
Other
150 stars 107 forks source link

controller in included views not correct #195

Closed lowap closed 6 years ago

lowap commented 6 years ago

Prerequisites

Steps to reproduce the issue

I have added this to TreeView:

'nodeAddlViews' => [ Module::VIEW_PART_2 => '@app/views/pmgrp/view' ] it's a standard view generated with giiant. Now in this view I have Gridviews for related data.

Expected behavior and actual behavior

Everything is working fine, the only problem is, that if I want to click on the eye to open the detailview of a certain record in the gridview, it's not working because the path is false:

http://app/ treemanager /controller/action

I was expecting...

http://app/controller/action...

Environment

Browsers

Operating System

Libraries

Isolating the problem

kartik-v commented 6 years ago

It is obvious - because you are using the tree view module's controller action to render your view (which is the reason it will default that controller's action)... you need to code your GridView widget in your custom view correctly. For example, edit the Action Column button settings to set the right controller action URL

lowap commented 6 years ago

Hi, I've tried to edit Action Column button settings, but unfortunately I can't figure it out how to do it in order to make controller treemanager go away. Can you please point me to the right direction? Please? Thank you in advance!

kartik-v commented 6 years ago

Read the yii2 documentation to understand how to use the GridView and grid columns - for your use case ... check the urlCreator property of GridView ActionColumn.

lowap commented 6 years ago

So I have Treemanager (the house), and on the top of it, I have a view (the roof). And you say, there is the opportunity to change the controller of the house, from the roof? As I see, it doesn't matter what I'm doing with the urlCreator, the treemanager will be always there. I can only change what is coming after it...?

kartik-v commented 6 years ago

It depends on how you have coded your app. This is actually more on how you program and setup your GridView (and actually nothing to do with this tree-manager module).

I cannot probably help you in your app coding. You can always skip/hide rendering the default buttons of the GridView Action column and render your own Action Column buttons ... for example setup the template property to some of your custom actions:

// your ActionColumn settings
'template' =>'{custom-update}', // hide other buttons and build your own button
'buttons' => [
    'custom-update' => function ($url, $model, $key) {
        return Html::a('Update', ['/your-controller/your-action', 'id' => $model->id]) : '';
    },
]

Please read the yii2 documentation to understand or recommend to post Yii2 related programming queries in the yii2-forum.

lowap commented 6 years ago

I don't believe that: I was trying something very similar, and it was not working, but now yours is working. Crazy. Thank you very much!