雷火电竞-中国电竞赛事及体育赛事平台

歡迎來(lái)到入門(mén)教程網(wǎng)!

Flex

當(dāng)前位置:主頁(yè) > 網(wǎng)絡(luò)編程 > Flex >

Flex中在Tree綁定數(shù)據(jù)后自動(dòng)展開(kāi)樹(shù)節(jié)點(diǎn)的方法

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-11|欄目:Flex|點(diǎn)擊:

用Flex/Flash做開(kāi)發(fā)的同志們應(yīng)該會(huì)使用 expandChildrenOf(item,true)方法來(lái)使用Tree組件在綁定數(shù)據(jù)后自動(dòng)展開(kāi)所有樹(shù)型節(jié)點(diǎn)(不需要用戶(hù)再自己點(diǎn)擊展開(kāi)節(jié)點(diǎn),會(huì)方 便許多),而在Flex開(kāi)發(fā)幫忙文檔中很明確寫(xiě)道:

"If you set dataProvider and then immediately call expandChildrenOf() you may not see the correct behavior. You should either wait for the component to validate or call the validateNow() method. "

第一種:(已驗(yàn)證)

復(fù)制代碼 代碼如下:

//全部展開(kāi),初始選中第一項(xiàng)

treePlayList.dataProvider=results;//刷新Tree的全部節(jié)點(diǎn)展開(kāi) - royanxin - royanxin的博客

treePlayList.validateNow(); //驗(yàn)證并更新此對(duì)象的屬性和布局,并重繪該對(duì)象(如果需要)。

treePlayList.selectedIndex=0;

treePlayList.expandChildrenOf(treePlayList.selectedItem,true);//全部展開(kāi)

第二種:
復(fù)制代碼 代碼如下:

setTimeout(IniExpand, 1000); //延時(shí)1秒

private function IniExpand():void {
TreeView1.selectedIndex=1;
TreeView1.expandItem(TreeView1.selectedItem,true);
}

第三種:
復(fù)制代碼 代碼如下:

//全部展開(kāi),初始未選中任何選項(xiàng)
sysTree.validateNow();
for each(var item:XML in this.sysTree.dataProvider){
sysTree.expandChildrenOf(item,true);
}

注意:

 

上一篇:Flex彈出窗口請(qǐng)求Action函數(shù)示例

欄    目:Flex

下一篇:flex內(nèi)嵌html網(wǎng)頁(yè)示例代碼

本文標(biāo)題:Flex中在Tree綁定數(shù)據(jù)后自動(dòng)展開(kāi)樹(shù)節(jié)點(diǎn)的方法

本文地址:http://www.jygsgssxh.com/a1/Flex/11597.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有