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

How to hide iconslist form? #212

Closed scmember closed 5 years ago

scmember commented 5 years ago

Hello!

Need to hide iconslist. The best I could is to add a line to _form from component, before line 249

<?php $iconsList = 'none'; ?>

it works but it's a very dirty hack. How can I set iconslist to none from module config or something?

thanks

kartik-v commented 5 years ago

Set it in iconEditSettings of TreeView widget:

use kartik\tree\TreeView;
echo TreeView::widget([
    'iconEditSettings' => ['show' => 'none'],  // to hide the icons list
   // other settings
]);
scmember commented 5 years ago

Unfortunatly it didn't work because of value is array, not string...

image

image

kartik-v commented 5 years ago

Not sure what the problem is from your end... here is what is passed to $iconsList in the view via the method getIconsList

scmember commented 5 years ago

Well, just debugged it, here are the results:

1) here we see that a proper value has passed to $__nodeIconsList image 2) then we see that a proper value has passed to iconsList attribute image 3) But! right after that we see that a proper string value magically becomes an array! image 4) So this condition will never been satisfied because of wrong type of iconsList image

Seems like a problem is somewhere in parseManageData method, maybe right here: image

kartik-v commented 5 years ago

Provided a fix. Check & confirm if resolved. You need to set this in iconEditSettings of TreeView widget as mentioned earlier:

use kartik\tree\TreeView;
echo TreeView::widget([
    'iconEditSettings' => ['show' => 'none'],  // to hide the icons list
   // other settings
]);
scmember commented 5 years ago

now it works like a charm! Thanks for quick support!