I have two joined tables clubs and members. I would like to create a simpletree of
Club1 Name
Member1
Member2
Club2 Name
Member1
Member2
etc.
I have used the $tree->render_sql method but I get an error because the parentid is compared to 0 and the id in the tables does not contain 0.
The log contains
SELECT members.club_id, clubs.id, clubs.name, members.last_name FROM clubs
LEFT OUTER JOIN members ON clubs.id = members.club_id WHERE clubs.id = ‘0’
I am very new at this. Any help would be appreciated.
Thank you I have looked over the article have no luck in setting up the grid. I still get an invalid index error. Do you have an example with data that would show how this is done?
unfortunately, we have not ready samples with several tables. Make sure that render_sql is corretly defined. It seems the there is not parent field in your tables, as teams.team_id and project_team.team_id are item ids. If there were a parent field in the clubs table, you could do the following:
$tree->render_sql(“SELECT members.club_id, clubs.id, clubs.name,clubs.parent_field FROM clubs
LEFT OUTER JOIN members ON clubs.id = members.club_id”,“id”,“name”,"",“parent_field”);
Could you give me an example or what form the parentID would take?
For example I have
Clubs Table
id
name
Members table
id
last_name
first_name
club_id
Right now I have the id of the clubs table and a clubs_id in the members table for use as a join field. Do I need to add a field in the members table or the clubs table.
root node is not shown - please check tree samples. If tree structure contains 3 levels: company->department->member, you need to add the new level to TreeMultitableConnector.
Hi, I think this will not solve my problem… I have the professional version of dhtmlxtree;) and I use the render_sql-function… As the levels are dynamically, it´s not possible, to set max level… and an other problem is, that based upon user rights everybody has different startpoints…
maxLevel allows to control child=“1” attribute automatically. For example if you have set maxLevel 2 and there are only 2 levels in tree (correct maxLevel in this case is 1), the second level will be rendered as folder (with +).
You may set any maxLevel, but in this case you’ll have to set onBeforeRender event and manage child attribute manually: