0 Replies Latest reply on Oct 14, 2014 8:46 AM by Michelle5002

    Previous Values of Selected Items in a Datagrid

    Michelle5002

      I have a datagrid which the dataprovider is bound to an ArrayCollection of Value Objects from a web service.

       

      One other thing which is important to point out.   The Value Objects are created automatically for the Data/Service and so if I change the files, they will just be overwritten the next time I make a change to the service.

       

      The grid displays Inventory Items.    Lets say that Item 1 has a qty of 20.   Item 5 has a Qty of 10.

       

      The list in this grid is based upon the selection of a Location tree.   So it lists the inventory items for a certain location.

       

      I also have a second tree and grid for the to location inventory items.

       

      Between the two grids, there is a button which when clicked it iterates thru the selected items and creates a new item in the to list with qty 1 and saves it.  then decreases the current qty in the from list by one.

       

      MoveINV.PNG

       

      So lets say I selected items 1 and 5 and then clicked the button.   A new copy of Items 1 and 5 are created in the to list with a qty of 1 and then saved.   Then the qty in the from list is decreased by 1 and saved and so the vales for 1 is now 19 and for 5 is 9.

       

      I would like to be able to change the qty in the from list to the qty I want to move.   So when the button is clicked the new item in the to list reflects the new qty and is saved.   Then the previous value of the current qty is decreased by the qty which is displayed in the grid

       

      So lets say I changed item 1 to 2 and Item 5 to 3 and then selected items 1 and 5 and then clicked the button.   A new copy of Items 1 and 5 are created in the to list with a qty of 2 for item 1 and 3 for item 5 and then saved.   Then the qty in the from list is decreased for Item 1 by 2 and item 5 by 3 and so now Item 1s qty is now 18 and items 5 qty is now 7.

       

      My first thought was if I had the previous values stored then no big deal.  But I put a break point at the point where the SelectedItems list is being iterated through and the previous values are not stored anywhere. 

       

      Any suggestions for this?