3 Replies Latest reply on Aug 25, 2006 3:18 PM by ntsiii

    Data Grid e4x issues

      I have noticed the following when using datatips in datagrids: if you use resultFormat="e4x" in your mx:HTTPService tag, you get the entire XML doc as your datatip. If you omit the resultFormat (and use the default object methodology), then the datatip works perfectly. That is an imperfect solution, however, if you are interested in utilizing e4x.

      Any idea how to fix this? Using dataTipField has no effect with e4x and using dataTipFunction yields the following error message:

      TypeError: Error #1034: Type Coercion failed: cannot convert XML@40e6929 element <resource id="200601" name="blah" type="service" version="1.0" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"> to mx.charts.HitData.

      One other question, I noticed that when using objects as opposed to e4x, if you have an xml tag with a numeric value of "1.0", the e4x treats it as a string and displays "1.0", however the object treats it as a number and displays "1". Is there a way to cast the object so that it displays "1.0" instead. I couldn't get it to work.

        • 1. Re: Data Grid e4x issues
          ntsiii Level 3
          The labelFunction will be the solution, but I don't know why you are getting the error.

          If I get a chance, I will look into this.

          I have never liked mx:Model or the default mx:Object resultFormat for that very reason: I can never predict exactly how Flex will deserialize the xml in an object structure. I used XML exclusively in 1.5 and am using e4x in2.0. So I can't help with the question, just advise staying with e4x.

          • 2. Re: Data Grid e4x issues
            peterent Level 2
            All data in XML is treated as Strings because an XML document is purely text. The Flex parser doesn't do any conversion - it would take too long to determine if every possible value is a String, Number, date, etc.

            If you believe you have a number, then do:

            var n:Number = Number( node.value );
            if( isNaN(n) ) n = 0; // node.value was not a legal number
            • 3. Re: Data Grid e4x issues
              ntsiii Level 3
              Hey, Peter.

              One uf us is misunderstanding the issue. I think he means that he has xml like this:

              and mx:Model is converting it to an Object with a reference path "root.1" when he is expecting a reference path: root.1.0. Obviously that path is invalid, so if the node Name has a period in it I think Model will never work quite right.