开发者

Flex tree won't show label, just the icon

开发者 https://www.devze.com 2023-03-25 23:42 出处:网络
I get the folder icon, never the label.I\'ve tried numerous datasources, always the same thing.File, ajax call, text, it always fails.

I get the folder icon, never the label. I've tried numerous datasources, always the same thing. File, ajax call, text, it always fails.

In the code below I even set a custom handler and watch the XML come in, I set a static text label going out. Never anything shown. This happens without the label function and using labelField. Yes, I'm 100% sure the attribute matches. Again, tried with numerous different datasources.

I don't know what would be obscuring the text, but not the icon. But I checked for that as well.

Tried this simple one file example, and it compiles fine.

Full code is below:

<?xml version="1.0" encoding="utf-8"?>
<s:HGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%">
<fx:Declarations>       
    <fx:XML id="selectedData2" source="assets/xml/orgchartmodel.xml"/>
</fx:Declarations>开发者_JAVA技巧;

<fx:Script>
    <![CDATA[   

        private function tree_labelFunc(item:XML):String {
            var label:String;

            label = "flexisshit";  //breakpoint hits here but I never see this text

            return label;
        }           
    ]]>
</fx:Script>

<mx:Tree id="tree" dataProvider="{selectedData2}" labelFunction="tree_labelFunc" width="100%" height="100%"  showRoot="false" textDecoration="underline" textSelectedColor="0xFFCCFF" depthColors="[#FFFFFF, #EEEEEE, #DDDDDD, #CCCCCC, #BBBBBB, #AAAAAA]" />
</s:HGroup>

The XML file used above (only part shown)

<employee layout="default" name="Eric Joplin" email="ejoplin@yoyodyne.com" phone="555-0100" fax="555-0101" businessUnit="Management" status="present" gender="male">
<employee name="Gary Roberts" layout="left_below" email="groberts@yoyodyne.com" phone="555-0100" fax="555-0101" businessUnit="Logistics" status="present" gender="male">
<employee layout="default" name="Alexander Burns" email="aburns@yoyodyne.com" phone="555-0102" fax="555-0103" businessUnit="Logistics" status="present" gender="male"/>
<employee layout="default" name="John Conner" email="jconner@yoyodyne.com" phone="555-0104" fax="555-0105" businessUnit="Logistics" status="present" gender="male"/>
</employee>
<employe ....


I tested out your code, it works for me so I'm guessing you have a css or some code somewhere that is embedding a font. Try setting the fontFamily to Verdana directly on the mx:Tree:

<mx:Tree id="tree"
         fontFamily="Verdana"
         width="100%" height="100%"
         textDecoration="underline"
         textSelectedColor="0xFFCCFF"
         dataProvider="{xmlListColl}"
         labelFunction="tree_labelFunc"
         showRoot="false"
         depthColors="[#FFFFFF, #EEEEEE, #DDDDDD, #CCCCCC, #BBBBBB, #AAAAAA]"
         />
0

精彩评论

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

关注公众号