4 Replies Latest reply on Sep 16, 2007 5:20 PM by Anti-Girl

    datagrid dataprovider = string?

    Anti-Girl
      can a datagrids, data provider not read from a string?

      [Bindable] public var connectionType:String = new String("connection.lastResult.results.record");

      <mx:DataGrid id="myDataGrid" dataProvider="{connectionType}................


      this wont work,
        • 1. Re: datagrid dataprovider = string?
          Senor_Roberto Level 1
          Data providers need to be an ArrayCollection or XMLListCollection.

          In your example, it's not clear what you're trying to achieve.

          Are you trying to cast every record in lastResult.results.record to a String and bind that to the DataGrid?



          • 2. Re: datagrid dataprovider = string?
            Anti-Girl Level 1
            Well i have 2 httpservices, and one datagrid, i was hoping i could change the dataprovider depending on which one is called.

            so i thought maybe i could call a string and change that when needed
            • 3. Re: datagrid dataprovider = string?
              Senor_Roberto Level 1
              Well, you can change the dataProvider easily enough, but it's still unclear what you're intentions are.

              You're binding a single string, not an array of data.
              Are you trying to bind the record? i.e.:

              [Bindable]
              public var connectionType:ArrayCollection = connection.lastResult.results.record;

              • 4. Re: datagrid dataprovider = string?
                Anti-Girl Level 1
                i dont think that worked, got error saying cannot convert to array etc, i had imported array util aswell,


                anyway i figured it out, i just added result="dataHandler()" to my HTTPSERVICE
                and then
                public function dataHandler():void
                {
                myDataGrid.dataProvider = connection.lastResult.results.record;

                }




                ____________________________________________
                i have 2 http servies, id connection1 and connection2,

                connection.lastResult.results.record; = displays result in datagrid

                i wanted to use the SAME datagrid to display connecion2's result BUT not at the same time, etc etc


                thanks alot for ur time