0 Replies Latest reply on Apr 6, 2009 8:03 AM by MM4D

    Datagrid + Combobox + AMFPHP Query.

      I've been using this:

       

      http://www.adobe.com/cfusion/communityengine/index.cfm?event=showDetails&postId=11846&prod uctId=2&loc=en_US

       

      To put combobox filters on a datagrid.

       

      This I managed, populate the datagrid with query run from a PHP page, and the comboboxes populated from data manually entered in an array in the Flex code.  This worked perfectly adequately, however I wanted to take it to the next level.

       

      I have installed AMFPHP and have got it working in populating the datagrid frrom the DB through AMF.  However the comboboxes now fill with [object Object], and this FDG:FilterDataGrid doesn't appear to support 'labelField' attribute, which I have used before.

       

      Has anyone got any thoughts on this, and what I can do to get round it?  Am I doing something universally wrong?

       

      In the code below there are two extra datagrids I put in just to make sure the info was being pulled through from AMFPHP, which it does.

       

      Regards.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
          xmlns:fdg="fdg.*"
          xmlns:filters="fdg.filters.*"
          layout="absolute"
          creationComplete="initApplication()">
      <mx:Script>
      <![CDATA[
          import mx.collections.ArrayCollection;
      [Bindable]
      public var dataProvider:Array;
      [Bindable]
      public var dataInstance:Array;

       

      import flash.net.Responder;
      public var gateway : RemotingConnection;
      public function initApplication():void
      {
      gateway = new RemotingConnection( "http://localhost/amfphp/gateway.php" );
      gateway.call( "moduleList2000.getData", new Responder(onResult, onFault));
      gateway.call( "moduleList2000.getInst", new Responder(onInstance, onFault));
      }
      public function onResult( result : Array ) : void
      {
          dataProvider = result;
      }

       

      public function onInstance (result : Array ): void
      {
          dataInstance = result;
      }

       

      public function onFault( fault : String ) : void
      {
      trace( fault );
      }

       

      ]]>
      </mx:Script>

       

          <fdg:FilterDataGrid dataProvider="{dataProvider}" width="800" height="250" x="10" y="39">
              <fdg:columns>
                  <filters:ComboBoxHeaderColumn headerText="Instance" dataField="inst_code" comboBoxDataProvider="{dataInstance}" headerRenderer="fdg.filters.renderer.ComboBoxHeaderRenderer" width="90"/>
                  <filters:ComboBoxHeaderColumn headerText="Trust Code" dataField="trust_code" comboBoxDataProvider="{dataProvider}" headerRenderer="fdg.filters.renderer.ComboBoxHeaderRenderer" width="80"/>
                  <filters:ComboBoxHeaderColumn headerText="Trust Name" dataField="trust_name" comboBoxDataProvider="{dataProvider}" headerRenderer="fdg.filters.renderer.ComboBoxHeaderRenderer" width="430"/>
                  <filters:ComboBoxHeaderColumn headerText="Module" dataField="mod_name" comboBoxDataProvider="{dataProvider}" headerRenderer="fdg.filters.renderer.ComboBoxHeaderRenderer" width="200"/>
              </fdg:columns>
          </fdg:FilterDataGrid>
          <mx:Label x="10" y="10" text="Adelante 1801085: Rev: 1.61h" id="lblBuild"/>
          <mx:DataGrid x="10" y="314" id="dgDataTest" dataProvider="{dataProvider}">
              <mx:columns>
                  <mx:DataGridColumn headerText="Instance" dataField="inst_code"/>
                  <mx:DataGridColumn headerText="Trust" dataField="trust_name"/>
                  <mx:DataGridColumn headerText="Module" dataField="mod_name"/>
              </mx:columns>
          </mx:DataGrid>
          <mx:DataGrid x="10" y="478" id="dgInstanceTest" dataProvider="{dataInstance}">
              <mx:columns>
                  <mx:DataGridColumn headerText="Instance" dataField="inst_code"/>
              </mx:columns>
          </mx:DataGrid>

       

         
             
         
      </mx:Application>