Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: is it possible to get a node with parents before like in a breadcrumb? #117

Closed
lowap opened this issue Jun 4, 2018 · 2 comments

Comments

@lowap
Copy link

lowap commented Jun 4, 2018

Hi,

Thank you for this extension. I have a node e.g. apple, I need to show it like: tree > fruit > apple
is this possible somehow?
Thx a lot!

@schmunk42
Copy link
Collaborator

@lowap
Copy link
Author

lowap commented Jun 4, 2018

I've found also just right now!
getBreadCrumbs()
http://demos.krajee.com/tree-manager#model-methods
thx a lot!

the one that you say, I don't know why but it's not working for me. Something is missing or I don't know. I need to call the function in the view for a dropdown, so I guess it's planned not for this, is it?

Oh, it's not really working somehow. Parents are not correct. I have this in model:

public function getDispName() { return $this->getBreadcrumbs(null, ' > ', null); }

and then in the form:

$form->field($model, 'group_id')->dropDownList( \yii\helpers\ArrayHelper::map(app\models\Pmgroup::find()->orderBy(['root' => SORT_ASC, 'lft' => SORT_ASC])->all(), 'id', 'dispName'), [ ]

Am I doing something wrong?

Ich habe's gefunden!
->addOrderBy('root, lft') - so ist richtig!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants