Reputation: 4837
I'm trying to make a custom field based on TreeListEx field, in reference to how a custom field was made using TreeList in this article:
http://sdn.sitecore.net/Scrapbook/Custom%20TreeList%20that%20supports%20query.aspx
Basically I need to be able to enable query syntax in the source field. Is there anyway to do this?
Upvotes: 1
Views: 368
Reputation: 4837
OK - so, solved this one. ItemID is not available in the treelistex class as a property, but it is available as a value, and that value is in viewstate. So all you really need to do is expose the viewstate in an itemID property, and use it just like in the treelist control.
public string ItemID
{
get
{
return StringUtil.GetString(this.ViewState["ItemID"]);
}
set
{
Sitecore.Diagnostics.Assert.ArgumentNotNull(value, "value");
this.ViewState["ItemID"] = value;
}
}
Upvotes: 1
Reputation: 3551
Not sure if the LuceneTreeListEx would save you any time in development. But to answer your question it should just be a case of creating a class that inherits from the TreeListEx control and overriding the Source property as in that example.
Essentially you are stripping the query:
and passing it to the database.SelectItems()
method.
You may want to look at the TreeListEx in reflector / DotPeek etc to see how its currently working.
Upvotes: 1