You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2019/11/18 20:14:01 UTC

[GitHub] [royale-asjs] nihavend opened a new issue #563: Tree component : labelFunction not implemented

nihavend opened a new issue #563: Tree component : labelFunction not implemented
URL: https://github.com/apache/royale-asjs/issues/563
 
 
   labelFunction not implemented in Tree component. The output for compiler : 
   
   ```
   D:\dev\royale-emulation-works\github\royale-testing\src\main\mtest\FindBug.mxml(73): col: 7 Error: This attribute is unexpected. It will be ignored.
   
                                            labelFunction="treeLabel"
                                            ^
   
   D:\dev\royale-emulation-works\github\royale-testing\src\main\mtest\FindBug.mxml(73): col: 7 Error: This attribute is unexpected. It will be ignored.
   
                                            labelFunction="treeLabel"
                                            ^
   ```
   
   Sample code : 
   
   ```
   <?xml version="1.0" encoding="utf-8"?>
   <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
   			   xmlns:s="library://ns.apache.org/royale/spark"
   			   xmlns:mx="library://ns.apache.org/royale/mx"
   			   paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0"
   			   height="100%" width="100%" 
   			   creationComplete="loadData()"
   			   >
   	
   	<fx:Metadata>
   	</fx:Metadata>
   	
   	<fx:Script>
   		<![CDATA[
   			
   			
   			[Bindable] 
   			public static var liveTreeDP:XMLList;
   			
   			public function loadData():void {
   				liveTreeDP = PInaraData;
   			}
   			
   			private function treeLabel(item:Object):String { 
   				
   				var node:XML = XML(item); 
   				//Alert.show(node.localName());
   				if (node.localName() == "list") {
   					return node.@title; 
   				} else if (node.localName() == "jobGroup") {
   					if(node.@id == "") {
   						// Alert.show("node : " + node);
   					}
   					return node.@title + " [Id:" + node.@id + "]"; 
   				} else if(node.localName() == "jobProperty") {
   					//return node.@name; 
   					if(node.@id == "") {
   						// Alert.show("node : " + node);
   					}
   					return node.@title + " [Id:" + node.@id + "]"; 
   				}
   				
   				return node;
   			} 
   			
   		]]>
   	</fx:Script>
   	
   	<fx:Declarations>		
   		<fx:XMLList id="PInaraData">
   			<list title="Grup Listesi" id="0">
   				<jobGroup title="Independents" id="-1">
   					<jobProperty title="SENSORDATA_HOURLY" id="1" statu="0" port="1"/>
   					<jobProperty title="SENSORDATA_DAILY" id="2" statu="0" port="1"/>
   					<jobProperty title="SENSORDATA_ALWAYSON" id="3" statu="0" port="1"/>
   					<jobProperty title="SENSORDATA_FIVE_MIN" id="4" statu="9" port="1"/>
   					<jobProperty title="PERSONAL_PROFILE_INFO" id="5" statu="9" port="1"/>
   					<jobProperty title="SENSORDATA_AVG_CONS" id="6" statu="9" port="1"/>
   				</jobGroup>
   			</list>
   		</fx:XMLList>
   	</fx:Declarations>	
   	
   	<s:layout>
   		<s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" />
   	</s:layout>
   	
   	<mx:Panel title="Tree Label Function Example"
   			  paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10"
   			  height="50%" width="50%">
   		
   			<mx:Tree id="myTree" width="50%" height="100%" labelField="@title"
   					 labelFunction="treeLabel"
   					 showRoot="true" dataProvider="{liveTreeDP}" />
   		
   	</mx:Panel>
   	
   </s:Application>
   ```
   @aharui I checked the AdvancedDataGrid, AdvancedListBase and ListBase but could not find the implementation for labelFunction. I need your assistance.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services