如何在 Flex 树组件中选择子节点?

发布于 2024-11-27 18:51:28 字数 1740 浏览 1 评论 0原文

如果我想检查父节点复选框意味着下面的子节点复选框将选择自动。

这是我的代码:

<fx:Script>
    <![CDATA[
        private function init():void    {
            httpTree.send();

        }

    ]]>
</fx:Script>
<fx:Declarations>
    <s:HTTPService id="httpTree" url="Assets/World.xml"  
                   resultFormat="e4x" useProxy="false" />
</fx:Declarations>
<mx:Tree dataProvider="{httpTree.lastResult.department}"
         id="treeTree" labelField="@name"   
         itemRenderer="com.ItemRenderForTree"  width="160" height="200" />

itemRenderer file

<fx:Script>
    <![CDATA[
        protected function checkboxSelectHandler(event:Event):void
        {

        }
    ]]>
</fx:Script>


<s:states>
    <s:State name="normal" />            
    <s:State name="hovered" />
    <s:State name="selected" />
</s:states>
<s:HGroup left="0" right="0" top="0" bottom="0" verticalAlign="middle">
    <s:Rect id="indentationSpacer" width="{treeListData.indent}" percentHeight="100" alpha="0">
        <s:fill>
            <s:SolidColor color="0xFFFFFF" />
        </s:fill>
    </s:Rect>
    <s:Group id="disclosureGroup">
        <s:BitmapImage source="{treeListData.disclosureIcon}" visible="{treeListData.hasChildren}" />
    </s:Group>
    <s:BitmapImage source="{treeListData.icon}" />
    <s:CheckBox change="checkboxSelectHandler(event)" />
    <s:Label id="labelField" text="{treeListData.label}" paddingTop="2"/>
</s:HGroup>

i Want out like this

任何人都可以帮忙,谢谢......

If i want check parent node checkbox means below childerns checkbox will select automatic .

this is my code:

<fx:Script>
    <![CDATA[
        private function init():void    {
            httpTree.send();

        }

    ]]>
</fx:Script>
<fx:Declarations>
    <s:HTTPService id="httpTree" url="Assets/World.xml"  
                   resultFormat="e4x" useProxy="false" />
</fx:Declarations>
<mx:Tree dataProvider="{httpTree.lastResult.department}"
         id="treeTree" labelField="@name"   
         itemRenderer="com.ItemRenderForTree"  width="160" height="200" />

itemRenderer file

<fx:Script>
    <![CDATA[
        protected function checkboxSelectHandler(event:Event):void
        {

        }
    ]]>
</fx:Script>


<s:states>
    <s:State name="normal" />            
    <s:State name="hovered" />
    <s:State name="selected" />
</s:states>
<s:HGroup left="0" right="0" top="0" bottom="0" verticalAlign="middle">
    <s:Rect id="indentationSpacer" width="{treeListData.indent}" percentHeight="100" alpha="0">
        <s:fill>
            <s:SolidColor color="0xFFFFFF" />
        </s:fill>
    </s:Rect>
    <s:Group id="disclosureGroup">
        <s:BitmapImage source="{treeListData.disclosureIcon}" visible="{treeListData.hasChildren}" />
    </s:Group>
    <s:BitmapImage source="{treeListData.icon}" />
    <s:CheckBox change="checkboxSelectHandler(event)" />
    <s:Label id="labelField" text="{treeListData.label}" paddingTop="2"/>
</s:HGroup>

i want out like this

any one can help thanks....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ゝ杯具 2024-12-04 18:51:29

你正在寻找我一直称之为薛定谔复选框的东西。这是一段相同的代码,包括一个工作演示和 adobe 上的复选框的 PNG 资源。
薛定谔复选框

You're looking for what I've always called a Schrodinger Check Box. Here is a same piece of code, including a working demo and the PNG resources for the checkbox over at adobe.
Schrodinger Check Box

兔小萌 2024-12-04 18:51:28

使用树 dataDescriptor 访问单击的父节点的子节点。也许这会有帮助?您的三个数据在数据模型中是否有选定的属性?

Use tree dataDescriptor to access children nodes of clicked parent node. Maybe that could help? Does your three data have a selected property in datamodel?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文