2 Replies Latest reply on Jun 10, 2010 5:04 PM by Mauricio Pacheco

    Custom HTTPService and bindable XML

    Mauricio Pacheco

      Sorry if the question was asked before, tried to search but did not find the exact solution. I created a custom HTTPService (extending the one provided in the Flex SDK). The custom service receives a text string and converts this to XML using a public, bindable variable like:

       

      [Bindable] public var xmlContent:XML=null;

       

      This works fine in all types of data components like grids, menus, trees, etc (using the binding notation {}). No problems except in cases where we have 2 data grids and they allow drag & drop between each other. The results are being weird, in some cases the dragged row is not moved but removed from the source grid and in other cases is copied but not removed. I think the problem is related to some event not being triggered to the data provider or grid to inform that the data changed. Researching this topic I found references that were saying we need to wrap this variable to an object proxy. I did this but the result is the same. If the HTTPService is set as:

       

      resultFormat="e4x"

       

      Then everything works fine. Any clues on what I am missing?

        • 1. Re: Custom HTTPService and bindable XML
          flairjax Level 1

          Can you post some code?  I am little confused on what you are trying to do. Just because you set something with a Bindable meta tag it doesn't make it bindable. Look into Collections or throw an even Bindable (event) meta information.

          • 2. Re: Custom HTTPService and bindable XML
            Mauricio Pacheco Level 1

            Thanks for the reply. In short and abbreviated, below is my custom service. I am not going to enter in details how the text is converted to XML, the function "convertTextToXML" returns a XML object already. The variable "xmlContent" is used in many data components, working fine in binding expression "{customService.xmlContent...}" except on the situation I described above: two grids (mx:DataGrid) having the same columns with the properties dragEnabled="true", dropEnabled="true" and dragMoveEnabled="true" so the user can move rows between them (in situations like selecting filter values, adding privileges, etc).

             

            package com.classes {

             

                import mx.rpc.events.ResultEvent;
                import mx.rpc.http.mxml.HTTPService;

             

                public class CustomService extends mx.rpc.http.mxml.HTTPService {

             

                    [Bindable] public var xmlContent:XML=null;

             

                    public function CustomService(rootURL:String=null,destination:String=null) {
                        super(rootURL,destination);
                        this.resultFormat="text";
                        this.addEventListener(ResultEvent.RESULT,resultListener);
                    }

             

                    private function resultListener(resultEvent:ResultEvent):void {

                        xmlContent=convertTextToXML(resultEvent.result);

                    }

                }

            }