Welcome Guest Search | Active Topics | Sign In | Register

Tree with child missing parent Options
exorgroup
Posted: Wednesday, February 27, 2008 11:49:33 PM
Rank: Member
Groups: Member

Joined: 12/18/2007
Posts: 20
We are using your tree controls - simple nice and simple as we like. It is loading information for the tree nodes from on table that has three columns > rowID, parentRow and rowTitle. This works fine as I said.

Sample Data

rowID, parentRow and rowTitle
1 , null, Home
2 , 1 , Home
3 , 1 , Home
4 , 2 , Home
5 , 9 , Home
6 , 3 , Home
7 , 3 , Home
8 , 3 , Home
10 , 9 , Home

If you notice row 5 has row 9 as parent but row 9 does not exist and someone might have deleted the record. With this scenario the tree does not display any information.

So, how can we make it still render details even with this problem? Or can we delete all the record under a node - hence killing both parent and children?

Duncan
eo_support
Posted: Thursday, February 28, 2008 6:02:18 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi Duncan,

The TreeView won't be able to do that for you. In order for a node to appear, it must have a parent node, so when the parent node does not exist, the TreeView won't display that node. The easiest way for you to do is to clear the record with a SQL statement. We are no SQL expert, but it should look something like this:

Code: SQL
DELETE your_table_name WHERE ParentRow in 
(
   SELECT A.ParentRow 
       FROM 
           your_table_name as A 
       LEFT JOIN 
           your_table_name as B
       ON 
           A.ParentRow = B.rowID
       WHERE
           B.RowID is NULL
)


Hope this helps.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.