1 Reply Latest reply on Jan 10, 2008 1:46 PM by

    Newbie questions

    jeffcg2
      I am just starting with Flex and beginner understanding of ActionScript. So everything is a question.
      I have Coldfusion 8 developer addition and updated my Coldfusion to 7.0.2 and gone thru the Flex/Coldfusion Project Wizard to get a simple data table Master/Detail Add/Edit/Update working on both setups. Now I am dissecting how it works.

      There is a datagrid that is getting data with the RemoteObject below. Selecting the datagrid in design view there is "Data provider:" What is supposed to go in here?

      <mx:RemoteObject
      id="dataManager"
      showBusyCursor="true"
      destination="ColdFusion" source="masons.components.cfgenerated.Members">
      <mx:method name="getMasterQuery" result="getMasterQuery_result(event)" fault="server_fault(event)" />
      <mx:method name="deleteItem" result="deleteItem_result(event)" fault="server_fault(event)" />
      </mx:RemoteObject>
        • 1. Re: Newbie questions
          Hey Jeff, welcome to Flex. As you might have guessed the dataProvider should point at the data collection that is retrieved by the RemoteObject. There are a couple ways to do this.

          One is to simply point it at dataProvider="{dataManager.getMasterQuery.lastResult}". Those curly braces make it a "binding" that will automatically update whenever lastResult updates, which happens whenever the service returns a result.

          The second, slightly more sophisticated approach is to have a result event handler function update the dataProvider. This is the approach that the CF wizard uses. In the snippet above you can see that it calls getMasterQuery_result(event) when the service returns a result. We don't see the implementation of that function in the snippet, but it does something like yourDatagrid.dataProvider = event.result . That's why the dataProvider tag attribute is empty in your generated code.

          Hope that helps,
          Tom