nihavend commented on issue #552: Tree component does not refresh after data provider content is updated. URL: https://github.com/apache/royale-asjs/issues/552#issuecomment-552299119 > I'm working on something else right now, but a quick glance at the generated code that was posted makes me think that the generated binding setter is probably not dispatching. > See ** comment below: > > ``` > liveTreeDP: { > get: function() { > return com.likya.pinara.comps.TreePanel.liveTreeDP_; > }, > > set: function(value) { > var oldValue = com.likya.pinara.comps.TreePanel.liveTreeDP_; > if (value != oldValue) { > com.likya.pinara.comps.TreePanel.liveTreeDP_ = value; > var dispatcher = com.likya.pinara.comps.TreePanel._bindingEventDispatcher; //** this should be '.staticEventDispatcher' not '._bindingEventDispatcher' > if (dispatcher) dispatcher.dispatchEvent(org.apache.royale.events.ValueChangeEvent.createUpdateEvent( > com.likya.pinara.comps.TreePanel, "liveTreeDP", oldValue, value)); > } > } > } > ``` > > Hopefully that is all that is needed. I can look at fixing this later today. However Serkan, if you want to confirm this you should be able to easily test it by making the change above in your js-debug output to see if it works. If you can confirm that, it would be helpful. (js-release won't work until this is addressed) I made the changes in the js but could not make it work. I prepared a simple example, I made the changes on this small sample but even the sample did not work. Also colud not make it to load tree data dynamically. Here is the source : ``` <?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[ import mx.collections.XMLListCollection; import mx.events.ListEvent; [Bindable] public var selectedNode:XML; [Bindable] public static var liveTreeDP:XMLList; public function loadData():void { liveTreeDP = <><node label="3 Node"></node></>; } public function Node3View():void { try { liveTreeDP = treeData3Node; myTree.validateNow(); } catch(err:Error) { //Alert.show("HATA : " + errorString); trace(err); } } public function Node6View():void { try { liveTreeDP = treeData6Node; myTree.validateNow(); } catch(err:Error) { //Alert.show("HATA : " + errorString); trace(err); } } private function tlosTree_itemClickHandler(e:ListEvent):void { } protected function liveTree_itemDoubleClickHandler(event:ListEvent):void { } public function treeChanged(event:Event):void { selectedNode=Tree(event.target).selectedItem as XML; } ]]> </fx:Script> <fx:Declarations> <fx:XMLList id="treeData3Node"> <node label="3 Node"> <node label="Inbox"> <node label="Marketing"/> <node label="Product Management"/> <node label="Personal"/> </node> <node label="Outbox"> <node label="Professional"/> <node label="Personal"/> </node> <node label="Spam"/> </node> </fx:XMLList> <fx:XMLList id="treeData6Node"> <node label="6 Node"> <node label="Inbox"> <node label="Marketing"/> <node label="Product Management"/> <node label="Personal"/> </node> <node label="Outbox"> <node label="Professional"/> <node label="Personal"/> </node> <node label="Spam"/> <node label="Sent"/> <node label="Region"> <node label="First"/> <node label="Second"/> </node> <node label="Division"> <node label="Up"/> <node label="Down"/> </node> </node> </fx:XMLList> <fx:XMLList id="treeData"> <node label="Mail Box"> <node label="Inbox"> <node label="Marketing"/> <node label="Product Management"/> <node label="Personal"/> </node> <node label="Outbox"> <node label="Professional"/> <node label="Personal"/> </node> <node label="Spam"/> <node label="Sent"/> </node> </fx:XMLList> </fx:Declarations> <s:layout> <s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" /> </s:layout> <s:Button id="TreeNode" click="Node3View()" label="3 Node"/> <s:Button id="SixNode" click="Node6View()" label="6 Node"/> <mx:Panel title="Tree Control Example" paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10" height="50%" width="50%"> <mx:Label width="100%" text="Select a node in the Tree control."/> <mx:HDividedBox width="100%" height="100%"> <mx:Tree id="myTree" width="50%" height="100%" labelField="@label" showRoot="false" dataProvider="{liveTreeDP}" change="treeChanged(event)"/> <mx:Tree id="myTreeStatic" width="50%" height="100%" labelField="@label" showRoot="false" dataProvider="{treeData}" change="treeChanged(event)"/> <mx:TextArea height="100%" width="50%" text="Selected Item: {selectedNode.@label}"/> </mx:HDividedBox> </mx:Panel> </s:Application> ```
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
