开发者

how to set truncateToFit option to true in the Tree in flex

开发者 https://www.devze.com 2023-03-30 08:26 出处:网络
I am trying to customise the truncateTo开发者_开发问答Fit option in my Custom Tree. In order to do that i have to render a LABEL into my tree as the tree is not having the TruncateToFit property. I am

I am trying to customise the truncateTo开发者_开发问答Fit option in my Custom Tree. In order to do that i have to render a LABEL into my tree as the tree is not having the TruncateToFit property. I am begineer to flex, and i surfed a lot to see how they have rendered label inside a tree but i dint find any solution.

Is my prediction right ? If it is right then how to render a label inside a tree component ?

<ns1:PLTree  verticalAlign="top" rendererIsEditor="true" columnWidth="150" height="100%" width="100%" x="0" y="0" borderThickness="0" dragEnabled="false" verticalScrollPolicy="auto" horizontalScrollPolicy="auto" dataProvider="{dBTree}"  iconFunction="getTreeIcon" labelField="label" iconField="icon" showRoot="false"  allowMultipleSelection="true" id="treTree" doubleClickEnabled="true" >
<ns1:itemRenderer>
    <mx:Component>
        <mx:Label truncateToFit="true" /> 
    </mx:Component>
</ns1:itemRenderer>
</ns1:PLTree> 

but if i do like this the tree's property get override and everything is displayed as text. output is follows

how to set truncateToFit option to true in the Tree in flex

kindly help me. Thanks a lot in advance.


You have to use an item renderer for that tree That item renderer would extend treeitemrenderer component. It should work fine

 <mx:Tree id="treeid"                                                                     
    width="100%" height="100%"  
    labelField="@label"                 
    itemRenderer="your renderer"/>


you also need to set maxlines or maxDisplayedLines to 1 when using to fit

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号