我使用業務包樹視圖組件進行菜單。我的目標是隻檢索沒有子類別的頂級菜單。子類別將僅在用戶圖標點擊(+/- 圖標)或菜單項點擊時顯示。在TreeView上單擊加載子類別Dotvvm
所以基本上當我點擊綁定到這個菜單對象的「a」或圖標時,我想要發送請求到我的服務器來獲取他的子類別等等。我不想在一個請求中獲得所有內容。
正如我注意到有鑑於兩個click處理程序。
1)使用Changed
屬性 - 當我使用這個屬性來處理click事件,我順利拿到正確的對象爲我CategorySelectedList
,但它只是直接的文本標籤上的點擊次數。對於圖標,它不再工作,類別菜單也不會擴展。
2)使用Events.Click
屬性 - 當我使用這個屬性來處理點擊事件。我甚至沒有將正確的對象放入我的CategorySelectedList
屬性中,但在這種情況下類別菜單將會擴大。
我無法從我的視圖中發送對象ID到SetActiveMenuNode
方法,所以我必須直接從我的CategorySelectedList
,但每個aproach有他自己的問題。
有沒有解決方案?
模型視圖
public List<CategoryListDTO> AdminMenuList { get; set; } = new List<CategoryListDTO>();
public List<CategoryListDTO> AdminMenuSelectedList { get; set; } = new List<CategoryListDTO>();
public void SetActiveMenuNode()
{
var selected = AdminMenuSelectedList.FirstOrDefault();
}
//načítání podkategorií
public StaticCommandBindingExpression LoadChildren { get; set; } = new StaticCommandBindingExpression(new CompiledBindingExpression(//something here));
我的觀點
<dot:Content ContentPlaceHolderID="MainContent">
<section class="content">
<bp:TreeView DataSource="{value: AdminMenuList}"
SelectedValues="{value: AdminMenuSelectedList}"
ItemKeyBinding="{value: Id}"
ItemHasChildrenBinding="{value: HasCategories}"
ItemChildrenBinding="{value: AssignedToCategory}"
LoadChildren="{staticCommand: _parent.MyMethod()}"
Changed="{command: SetActiveMenuNode()}"
>
<p>{{value: Name}}</p>
</bp:TreeView>
</section>
好的,謝謝你的回答。 – Martin
我對你有個好消息。該功能將在下一個測試版本中提供。 –
感謝您的信息。當下一個beta版本應該發佈? – Martin