0 Replies Latest reply on Apr 18, 2007 8:43 AM by dimival

    Updating items inside a fill method

    dimival Level 1
      Hello, i am having troubles when using DataServices in my app. Here's
      the thing:

      I have an Assembler and a DataService component that points to that Assembler. I have a Datagrid for showing a list of elements and a Form for inserting new one. The DataGrid is filled by pressing a button that calls the fill method of the Assembler.

      The type of object i am using has a property called winner that is a boolean and defaults to false, the fill method obtains a list of bids from the database and before the return statement, it iterates it to determine if each bid is a possible winner or not, setting the winner property to true or false. So each time the fill method is executed by the client or by a refreshFill it checks these conditions and determines possible winners.

      I call the fill method and the DG is filled with the result of the fill method, then i create a new Bid and fill it with the Form (the
      default value for winner is false) and then call the createItem method, which inserts it into the database and automatically triggers an refreshFill that once again obtains the list of bids and determines which one is a possible winner and which isn't.

      The problem is that if the recently added item is a possible winner i am setting its property to true but on Flex it remains as false. Additionally if any other bid that was already on the list changes its property from true to false or viceversa, Flex won't see these changes.
      Before the return statement of the fill method i am printing the values of the bids and there i see that the values of the winner property are in fact being done but on the DataGrid those changes don't occur :S.

      So the thing is that the refreshFill that is automatically triggered after the createItem is obtaining the right data but Flex just doesn't show it correctly.

      Any ideas? Please help!!!