3 Replies Latest reply on Apr 5, 2011 5:53 AM by HenrySeng-CH

    selectable ranges in datechooser from database

    Gilgeam

      Hi guys!

       

      I got a problem, I'm trying to set ranges in a datechooser. The code I use is this:

       

      <mx:DateChooser horizontalCenter="0" bottom="0" top="0" width="75%" id="calendario_desde"  creationComplete="fecha_desde_inicio()"/>

       

      protected function fecha_desde_inicio():void

      {

      fecha_desde.token =  database.fecha_desde();

       

      anio= fecha_desde.lastResult.valor1;

      mes = fecha_desde.lastResult.valor2;

      dia = fecha_desde.lastResult.valor3;

       

       

       

      dRanges.push({rangeStart:new Date(anio,mes,dia), rangeEnd: new Date (2011,2,1)});

       

      calendario_desde.selectableRange = dRanges;

       

      }

       

       

      Could you tell me what's wrong?

       

      Thanks

        • 1. Re: selectable ranges in datechooser from database
          HenrySeng-CH Level 1

          DateChooser.selectableRange accepts an object having startRange and endRange properties. In your version, you give it an array! containing an object containing the 2 properties

           

          try this:

           

          protected function fecha_desde_inicio():void

          {

               fecha_desde.token =  database.fecha_desde();

           

               anio= fecha_desde.lastResult.valor1;

               mes = fecha_desde.lastResult.valor2;

               dia = fecha_desde.lastResult.valor3;

           

           

           

           

               var range:Object = new Object();

               range.rangeStart = new Date(anio,mes,dia);

               range.rangeEnd = new Date (2011,2,1);

           

           

               calendario_desde.selectableRange = range;

           

          }

           

          or this :

           

          protected function fecha_desde_inicio():void

          {

               fecha_desde.token =  database.fecha_desde();

           

               anio= fecha_desde.lastResult.valor1;

               mes = fecha_desde.lastResult.valor2;

               dia = fecha_desde.lastResult.valor3;

           

           

               calendario_desde.selectableRange = {rangeStart : new Date(anio,mes,dia), rangeEnd : new Date(2011,2,1)};

           

          }

          • 2. Re: selectable ranges in datechooser from database
            Gilgeam Level 1

            Thanks a lot!

             

            But I still got a small problem. I want to set ranges at start and when I use this code on creationcomplete event it doesn't work.

             

             

            how can i do it?

            • 3. Re: selectable ranges in datechooser from database
              HenrySeng-CH Level 1

              what happens? isn't a problem with your data?