2 Replies Latest reply on Jan 13, 2009 8:34 AM by GeorgeWS

    Summing and Datagrid

    GeorgeWS Level 1
      I have a datagrid it lists products and how much each sold by month: 01 ProdA 5, 02 ProdA 7 and so on each product will have 12 records by the end of the year. I have a slider that has 12 ticks and 2 thumbs. I want the numbers to sum as I move the thumbs. Is this even possible? so if I moved them to the first and second ticks instead of 2 records there would be 1, that just had ProdA 12 and if I include another month (sliding the right thumb to the right one tick) it would ad that value to the ProdA. Im sure this is done in action script.


        • 1. Re: Summing and Datagrid
          ntsiii Level 3
          Sure. Have the change event on the slider invoke a filter on the dataProvider.
          • 2. Re: Summing and Datagrid
            GeorgeWS Level 1
            I was thinking the same thing I just dont know how that AS would look like; I have this:

            private function sliderFilterFunc(item:Object):Boolean {
            var minSlider:uint = slider.values[0];
            var maxSlider:uint = slider.values[1];
            if ((item.value >= minSlider) &&
            (item.value <= maxSlider)) {
            return true;
            } else {
            return false;

            The value column is the months and the slider has 12 ticks. So I think I need a loop with an add to add each months data? If the sliders are set appart all the way that shows 12 months creating 12 records for each item. I just want 1 record for each item all the time, just the numbers would change as the slider changes alowwing for someone to get the quarters or tertile totals. Can you show me what the looping add part would look like?
            I have not seen any samples doing this. Thanks as always