7 Replies Latest reply on Jul 3, 2007 2:26 PM by ntsiii

    uanble to bind to property

      I cannot figure out why I am getting this error. I have a datagrid component with a XML data provider.

      warning: unable to bind to property 'memory' on class 'XML' (class is not an IEventDispatcher)
      warning: unable to bind to property 'value' on class 'XMLList' (class is not an IEventDispatcher)
      warning: unable to bind to property 'disks' on class 'XML' (class is not an IEventDispatcher)
      warning: unable to bind to property 'value' on class 'XMLList' (class is not an IEventDispatcher)

      Everything is working correctly so why am I getting these warnings? My application is very simple but the warning comes up when I click on my datagrid item. This is the basic code:

      [Bindable]
      private var _data:XML;

      private function resultHandler(event:ResultEvent):void {

      _data = new XML(event.result);

      }


      My datagrid dataProvider="{_data.file}"...........The code when I select an item is:

      <mx:Label text="{dg.selectedItem.memory}"/>
      <mx:Label text="{dg.selectedItem.memory.@value}"/>
      ....

      I am new to Flex and this is driving me crazy.
        • 1. Re: uanble to bind to property
          Confused still.
          • 2. Re: uanble to bind to property
            AwesomeDigital3 Level 1
            I get the same warning, but it works for me too.

            Is this something we can fix, or should we just ignore the warning?


            Mathias
            • 3. Re: uanble to bind to property
              AwesomeDigital3 Level 1
              poisonver

              I just solved my issue

              Is the dataprovider for your datagrid an array that is defined in a class?

              Mine is. When I made the class bindable, the warnings went away.

              e.g.

              [Bindable]
              public class Individual
              {


              If your set up is the same, give that a try.


              Mathias

              1 person found this helpful
              • 4. Re: uanble to bind to property
                Nope I am using xml as a dataprovider from an HTTP service call.

                I think that it is binding to the xml file but I have attributes inside that are not binding and I believe that is the problem. So I still don't have an answer and it still is driving me nuts.
                • 5. Re: uanble to bind to property
                  gjastrab Level 1
                  Is this resultHandler being called from an HTTPService? If so, try the following:

                  <mx:HTTPService id="srv" ... />

                  <mx:DataGrid dataProvider="{srv.lastResult.file}" />
                  1 person found this helpful
                  • 6. uanble to bind to property
                    Yeah I tried that too I get the warning only when I click on the datagrid row I use
                    {dg.selectedItem.os}
                    {dg.selectedItem.os.@value}

                    As stated it is binding the xml class but not any attributes inside the xml meaning that it is setup like:

                    <files>
                    <file fileName="foobar" firstName="foo">
                    <os value="pass">Windows XP Professional</os>
                    etc.......
                    </file>
                    etc...
                    </files>

                    • 7. Re: uanble to bind to property
                      ntsiii Level 3
                      selectedItem is an Object and so is not recognized as XML. Cast the reference:
                      <mx:Label text="{XML(dg.selectedItem).memory.@value}"/> (technically not a cast, but a top-level function call)

                      If you don't need binding, consider directly assigning the value"
                      <mx:Label id="lbl1" initialize="lbl1.text=dg.selectedItem.memory.@value" ../>

                      Much lower overhead and avoids the binding warning without the cast.

                      Tracy
                      1 person found this helpful