3 Replies Latest reply on Sep 8, 2009 8:52 AM by Andrew Rosewarn

    Advanced data grid resizing

    bk843746

      Hi

       

      If I pin an advanced data grid to a canvas in all four corners and resize the canvas, the height of the data grid will change to fit the canvas but the width of the data grid will not change.

       

      How do I configure the data grid to change its width when the canvas width changes?

        • 1. Re: Advanced data grid resizing
          Andrew Rosewarn Level 3

          Hi

           

          How are you pinning the datagrid in the canvas.  Are you setting the left, right, top and bottom properties to 0.  I have just done the following and am having no problems?

           

          Perhaps you could provide more details.

           

          <?xml version="1.0"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

           

              <mx:Canvas left="84" right="110" top="82" bottom="74">
                  <mx:AdvancedDataGrid id="adg1" designViewDataType="tree" left="0" right="0" top="0" bottom="0">
                      <mx:columns>
                          <mx:AdvancedDataGridColumn headerText="Column 1" dataField="col1"/>
                          <mx:AdvancedDataGridColumn headerText="Column 2" dataField="col2"/>
                          <mx:AdvancedDataGridColumn headerText="Column 3" dataField="col3"/>
                      </mx:columns>
                  </mx:AdvancedDataGrid>
              </mx:Canvas>
          </mx:Application>

           

          Thanks

           

          Andrew

          • 2. Re: Advanced data grid resizing
            bk843746 Level 1

            Hi Andrew

             

            I forgot to mention that I was creating the canvas and adding it to a tab navgiator with code. I see the problem now. I need to set the left, top, right and bottom properties of the canvas after I create it.

             

            How is this done? The canvas class doesn't have these properties.

             

            Thanks

            • 3. Re: Advanced data grid resizing
              Andrew Rosewarn Level 3

              Hi

               

              Sorry I shouldn't have used the term properties, they are styles.

               

              <?xml version="1.0"?>
              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
                 
                  <mx:Script>
                      <![CDATA[
                          private function init():void {
                              can.setStyle('left',10);
                              can.setStyle('right',10);
                              can.setStyle('top',10);
                              can.setStyle('bottom',10);
                          }
                         
                      ]]>
                  </mx:Script>
                  <mx:Canvas id="can" x="99" y="121" width="200" height="200" backgroundColor="#C58E8E">
                  </mx:Canvas>
              </mx:Application>

               

              Andrew