5 Replies Latest reply on Feb 12, 2008 4:44 PM by ignite

    DataGrid, itemRenderer, viewStacks

    ignite
      I am using an inline itemRenderer for an image on a Datagrid which rests in a viewStack. However, if the Datagrid is not in the first index of the viewStack the itemRenderer will not load. I've tried changing the creationPolicy of the viewStack with no avail. Any ideas?

      Thanks
      Ruben
        • 1. Re: DataGrid, itemRenderer, viewStacks
          tpeter2
          Did you ever get a solution to this problem? I too, am having similar issues when using a datagrid in a viewstack.

          Thanks,
          Terra
          • 2. Re: DataGrid, itemRenderer, viewStacks
            Arty13
            Can either of you be more specifc with your issue? Or provide any sample code?

            Thanks,

            Art
            • 3. Re: DataGrid, itemRenderer, viewStacks
              tpeter2 Level 1
              What I am trying to do is create a ViewStack that contains two DataGrid's. The first Datagrid will only contain 5 rows of data; the second will contain multiple lines, thus requiring a vertical scroll bar. When I trigger an event to show the second DataGrid the vertical scroll bar does not allow me to scroll past a certain point. It seems that the second DataGrid in the ViewStack inherits the properties from the first one.

              Here's a sample:


              <mx:ViewStack id="gridVS" width="100%" height="100%" creationPolicy="all">
              <mx:VBox width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off">
              <mx:DataGrid id="milestoneGrid" height="100%" styleName="myDataGrid" width="100%" dataProvider="{statusData}" rowCount="8" variableRowHeight="true" enabled="false">
              <mx:columns>
              <mx:Array>
              <mx:DataGridColumn dataField="itemLabel" headerText="Milestone" width="120"/>
              <mx:DataGridColumn dataField="schedDate" headerText="Scheduled Start Date" width="120"/>
              <mx:DataGridColumn dataField="startDate" headerText="Started"/>
              <mx:DataGridColumn dataField="status" headerText="Status"/> <mx:DataGridColumn dataField="endDate" headerText="Completed"/>
              </mx:Array>
              </mx:columns>
              </mx:DataGrid>
              </mx:VBox>
              <mx:VBox width="100%" height="100%">
              <mx:DataGrid id="areaGrid" styleName="myDataGrid" width="100%" height="100%" selectable="true" rowCount="8" dataProvider="{statusData}" enabled="true" editable="false" variableRowHeight="true" >
              <mx:columns>
              <mx:Array>
              <mx:DataGridColumn dataField="itemLabel" headerText="Area" width="270" wordWrap="true"/>
              <mx:DataGridColumn dataField="startDate" headerText="Started"/>
              <mx:DataGridColumn dataField="endDate" headerText="Completed"/>
              <mx:DataGridColumn dataField="status" headerText="Status"/>
              <mx:DataGridColumn dataField="user" headerText="Run By"/>
              </mx:Array>
              </mx:columns>
              </mx:DataGrid>
              </mx:VBox>
              </mx:ViewStack>
              • 4. Re: DataGrid, itemRenderer, viewStacks
                Gregory Lafrance Level 6
                In the following code (modified version of yours) if you remove enabled="false" from the milestoneGrid datagrid it seems to work:

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

                <mx:ArrayCollection id="statusData">
                <mx:Object>
                <mx:itemLabel>M1</mx:itemLabel>
                <mx:schedDate>01/01/2008</mx:schedDate>
                <mx:startDate>01/01/2008</mx:startDate>
                <mx:endDate>01/10/2008</mx:endDate>
                <mx:user>Bob Smith</mx:user>
                <mx:status>overdue</mx:status>
                </mx:Object>
                <mx:Object>
                <mx:itemLabel>M2</mx:itemLabel>
                <mx:schedDate>01/01/2008</mx:schedDate>
                <mx:startDate>01/01/2008</mx:startDate>
                <mx:endDate>01/10/2008</mx:endDate>
                <mx:user>Bob Smith</mx:user>
                <mx:status>overdue</mx:status>
                </mx:Object>
                <mx:Object>
                <mx:itemLabel>M3</mx:itemLabel>
                <mx:schedDate>01/01/2008</mx:schedDate>
                <mx:startDate>01/01/2008</mx:startDate>
                <mx:endDate>01/10/2008</mx:endDate>
                <mx:user>Bob Smith</mx:user>
                <mx:status>overdue</mx:status>
                </mx:Object>
                <mx:Object>
                <mx:itemLabel>M4</mx:itemLabel>
                <mx:schedDate>01/01/2008</mx:schedDate>
                <mx:startDate>01/01/2008</mx:startDate>
                <mx:endDate>01/10/2008</mx:endDate>
                <mx:user>Bob Smith</mx:user>
                <mx:status>overdue</mx:status>
                </mx:Object>
                <mx:Object>
                <mx:itemLabel>M5</mx:itemLabel>
                <mx:schedDate>01/01/2008</mx:schedDate>
                <mx:startDate>01/01/2008</mx:startDate>
                <mx:endDate>01/10/2008</mx:endDate>
                <mx:user>Bob Smith</mx:user>
                <mx:status>overdue</mx:status>
                </mx:Object>
                <mx:Object>
                <mx:itemLabel>M6</mx:itemLabel>
                <mx:schedDate>01/01/2008</mx:schedDate>
                <mx:startDate>01/01/2008</mx:startDate>
                <mx:endDate>01/10/2008</mx:endDate>
                <mx:user>Bob Smith</mx:user>
                <mx:status>overdue</mx:status>
                </mx:Object>
                <mx:Object>
                <mx:itemLabel>M7</mx:itemLabel>
                <mx:schedDate>01/01/2008</mx:schedDate>
                <mx:startDate>01/01/2008</mx:startDate>
                <mx:endDate>01/10/2008</mx:endDate>
                <mx:user>Bob Smith</mx:user>
                <mx:status>overdue</mx:status>
                </mx:Object>
                <mx:Object>
                <mx:itemLabel>M8</mx:itemLabel>
                <mx:schedDate>01/01/2008</mx:schedDate>
                <mx:startDate>01/01/2008</mx:startDate>
                <mx:endDate>01/10/2008</mx:endDate>
                <mx:user>Bob Smith</mx:user>
                <mx:status>overdue</mx:status>
                </mx:Object>
                </mx:ArrayCollection>

                <mx:HBox borderStyle="solid">
                <mx:Button label="Datagrid One"
                click="gridVS.selectedChild=dg1;"/>
                <mx:Button label="Datagrid Two"
                click="gridVS.selectedChild=dg2;"/>
                </mx:HBox>

                <mx:ViewStack id="gridVS" width="100%" height="100%" creationPolicy="all">
                <mx:VBox id="dg1" width="100%" height="100%"
                verticalScrollPolicy="off" horizontalScrollPolicy="off">
                <mx:DataGrid id="milestoneGrid" height="100%" styleName="myDataGrid"
                width="100%" dataProvider="{statusData}" rowCount="8"
                variableRowHeight="true" enabled="false">
                <mx:columns>
                <mx:Array>
                <mx:DataGridColumn dataField="itemLabel" headerText="Milestone" width="120"/>
                <mx:DataGridColumn dataField="schedDate" headerText="Scheduled Start Date" width="120"/>
                <mx:DataGridColumn dataField="startDate" headerText="Started"/>
                <mx:DataGridColumn dataField="status" headerText="Status"/> <mx:DataGridColumn dataField="endDate" headerText="Completed"/>
                </mx:Array>
                </mx:columns>
                </mx:DataGrid>
                </mx:VBox>
                <mx:VBox id="dg2" width="100%" height="100%">
                <mx:DataGrid id="areaGrid" styleName="myDataGrid" width="100%" height="100%"
                selectable="true" rowCount="8" dataProvider="{statusData}" enabled="true"
                editable="false" variableRowHeight="true" >
                <mx:columns>
                <mx:Array>
                <mx:DataGridColumn dataField="itemLabel" headerText="Area" width="270" wordWrap="true"/>
                <mx:DataGridColumn dataField="startDate" headerText="Started"/>
                <mx:DataGridColumn dataField="endDate" headerText="Completed"/>
                <mx:DataGridColumn dataField="status" headerText="Status"/>
                <mx:DataGridColumn dataField="user" headerText="Run By"/>
                </mx:Array>
                </mx:columns>
                </mx:DataGrid>
                </mx:VBox>
                </mx:ViewStack>
                </mx:Application>
                • 5. Re: DataGrid, itemRenderer, viewStacks
                  ignite Level 1
                  I don't know if you are having the same issue I had. I fixed my issue by changing the DataGridColumn width. For some reason when the DataGrid was placed in a viewstack the width was rendered differently for each column. The actual itemrenderer was showing up fine, but the column was not visible.