Hi.
I try to use your fix. It work in js, but doesn`t work like tree.
I change types to guid your sample, and tree become flat!
public class DxNewsGroupEntry {
Guid m_id;
Guid? m_parentId;
string m_from, m_subject, m_text;
DateTime m_date;
bool m_hasAttachment;
public Guid ID {
get { return m_id; }
set { m_id = value; }
}
public Guid? ParentID
{
get { return null; }
set { m_parentId = value; }
}
...
public static void Insert(DxNewsGroupEntry item) {
Data.Add(item);
item.ID = Guid.NewGuid();
}
static DxNewsGroupEntry FindItem(Guid id) {
foreach(DxNewsGroupEntry item in Data)
if(item.ID == id)
return item;
return null;
}
...
static DxNewsGroupData CreateData() {
DxNewsGroupData list = new DxNewsGroupData();
using(AccessDataSource ds = new AccessDataSource("~/App_Data/DataSources/NewsGroups.mdb", "select * from Threads")) {
DataView view = ds.Select(DataSourceSelectArguments.Empty) as DataView;
Guid? old = null;
foreach(DataRowView row in view) {
DxNewsGroupEntry entry = new DxNewsGroupEntry();
entry.ID = Guid.NewGuid();
entry.ParentID = old;
old = entry.ID;
entry.From = row["From"].ToString();
entry.Subject = row["Subject"].ToString();
entry.Text = row["Text"].ToString();
entry.Date = (DateTime)row["Date"];
entry.HasAttachment = (bool)row["HasAttachment"];
list.Add(entry);
}
}
return list;
}
Hello,
This is a different problem and it has a different cause. Please start a new thread for new issue reports. You can refer to other threads by providing their IDs.
The problem is caused by the fact that the key and parent fields are of different types - Guid and Nullable Guid:
Guid m_id;
Guid? m_parentId;
The TreeList requires the key and parent fields to be of the same type.
Thanks,
Nick
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.
Facebook
Twitter
Google+