我有一个RadFileExplorer,我的问题是我在javascript中关闭一个弹出页面后找不到折叠节点的方法。我的代码不起作用。
function collapseNodes() {
$find("<%= RadAjaxPanel1.ClientID%>").ajaxRequestWithTarget("<%= RadAjaxPanel1.UniqueID %>", "Refresh");
var explorer = $find("<%=RadFileExplorer1.ClientID%>");
var tree = explorer.get_tree();
var nodes = tree.get_allNodes(); --> this part is not working
nodes.forEach(function(node) { --> this part is not working
if (node.get_expanded()) --> this part is not working
node.set_expanded(false);--> this part is not working
});
}
<telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="100%" EnableOpenFile="false"
EnableCreateNewFolder="true" OnItemCommand="RadFileExplorer1_ItemCommand" OnExplorerPopulated="RadFileExplorer1_ExplorerPopulated"
DisplayUpFolderItem="false" >
<keyboardshortcuts delete="delete" uploadfile="Ctrl+u" newfolder="Ctrl+n" />
</telerik:RadFileExplorer>
答案 0 :(得分:0)
首先需要 get_nodes()来自treeview对象:http://www.telerik.com/help/aspnet-ajax/treeview-client-objects-radtreeview.html。
然后, get_count()将返回计数,以便您可以进行for循环,节点集合中没有forEach方法:http://www.telerik.com/help/aspnet-ajax/treeview-client-objects-radtreenodecollection.html。
只有这样才能将给定节点的客户端API用于get_expanded()和set_expanded():http://www.telerik.com/help/aspnet-ajax/treeview-client-objects-radtreenode.html。请查看第一篇文章中get_nodes()方法下面的示例。