# |
Feb 3rd 2018, 22:11 |
hmic |
rather a nice explanation on who to think of working with the tree... |
# |
Feb 3rd 2018, 22:11 |
hmic |
;) |
# |
Feb 3rd 2018, 22:11 |
ahmed_bodi |
thats a nice solution |
# |
Feb 3rd 2018, 22:10 |
hmic |
this way you can get a tree of all users of you app too :D |
# |
Feb 3rd 2018, 22:10 |
hmic |
just make evey user level 1 below your "app" root-node |
# |
Feb 3rd 2018, 22:10 |
ahmed_bodi |
hm? how so? |
# |
Feb 3rd 2018, 22:10 |
hmic |
you dont need that |
# |
Feb 3rd 2018, 22:10 |
hmic |
why? |
# |
Feb 3rd 2018, 22:09 |
ahmed_bodi |
each user would be a root node |
# |
Feb 3rd 2018, 22:09 |
ahmed_bodi |
for now yes, in the future nope |
# |
Feb 3rd 2018, 22:08 |
hmic |
there is only one root node in the table, isn't it? :p |
# |
Feb 3rd 2018, 22:07 |
ahmed_bodi |
:P |
# |
Feb 3rd 2018, 22:07 |
ahmed_bodi |
haha, would do if i wasnt allowing user signups |
# |
Feb 3rd 2018, 22:05 |
hmic |
just dont insert the root through the ORM :p |
# |
Feb 3rd 2018, 22:05 |
ahmed_bodi |
@hmic the default buildrules for my model, its checking existsIn for the parent_id but its set to null as it should for the root node, safe to remove? |
# |
Feb 3rd 2018, 22:00 |
greenjam94 |
Setting the display field works perfectly, thanks for the help (and for answering my earlier question) |
# |
Feb 3rd 2018, 21:59 |
hmic |
additionally, you can change the find('list') call in the controller and provide the valueField parameter to its options array, to specify which field to use |
# |
Feb 3rd 2018, 21:59 |
greenjam94 |
ah! I'll try that |
# |
Feb 3rd 2018, 21:58 |
hmic |
you can change it there |
# |
Feb 3rd 2018, 21:58 |
hmic |
greenjam94: it populates the display field from the table |
# |
Feb 3rd 2018, 21:58 |
greenjam94 |
ahmed_bodi: I need to clarify, this is a select control, not a regular text input. I need to change the name of each select option, it's pulling the wrong column from the entity |
# |
Feb 3rd 2018, 21:57 |
hmic |
jason001, no worries |
# |
Feb 3rd 2018, 21:56 |
ahmed_bodi |
no worries :) |
# |
Feb 3rd 2018, 21:56 |
ahmed_bodi |
wanted to avoid coding it up until i knew the structure worked for what i wanted |
# |
Feb 3rd 2018, 21:56 |
jason001 |
so should I just copy-paste my apology from above? thank you hmic |
# |
Feb 3rd 2018, 21:56 |
hmic |
there is a method to do so (regenerate from either lft/rgt or parent_id) |
# |
Feb 3rd 2018, 21:56 |
hmic |
hint: it will be enough to populate the parent_id and let cake fix the tree |
# |
Feb 3rd 2018, 21:55 |
hmic |
ahmed_bodi, you dont need to manually populate them. you should read the docs on how the tree works |
# |
Feb 3rd 2018, 21:55 |
hmic |
jason001, yes, you do, usually... which makes that not so much a cake question :P |
# |
Feb 3rd 2018, 21:55 |
ahmed_bodi |
@hmic i'm trying to get the tree table going with some sample data and im confused as to what to put for left and right any clues? |
# |
Feb 3rd 2018, 21:54 |
jason001 |
@hmic - there are alot of parameters at play... one of which is my webhost. I have a few things to look at, thank you for your time |
# |
Feb 3rd 2018, 21:54 |
ahmed_bodi |
instead of false put what you want |
# |
Feb 3rd 2018, 21:54 |
ahmed_bodi |
<?= $this->Form->input('first_name', ['class' => 'form-control', 'placeholder' => 'First Name', 'label' => false]); ?> |
# |
Feb 3rd 2018, 21:54 |
hmic |
greenjam94: add 'label' => 'Name' to the options array |
# |
Feb 3rd 2018, 21:53 |
ahmed_bodi |
one sec |
# |
Feb 3rd 2018, 21:53 |
ahmed_bodi |
with the label option |
# |
Feb 3rd 2018, 21:53 |
ahmed_bodi |
@greenjam94 yes |
# |
Feb 3rd 2018, 21:53 |
hmic |
it does work, i'm using a solution of the 5th hit, so you dont need to look further |
# |
Feb 3rd 2018, 21:53 |
greenjam94 |
for a select statement, can you set the label of the drop downs? I have the following: ``` echo $this->Form->control('listing_id', ['options' => $listings]); ``` but it's listing options with the labels being "title" which is incorrect, I need it to be "name" |
# |
Feb 3rd 2018, 21:52 |
hmic |
- or learn apache and understand how mod_rewrite works better - which is hard! |
# |
Feb 3rd 2018, 21:52 |
jason001 |
none of which work.... thank you hmic. |