4 Replies Latest reply on Mar 5, 2008 7:15 PM by ntsiii

    DataGrid: row wrap?

    Fauerbach_Consulting
      I have a datagrid with approximately 20 columns. Way too many for a standard 1024x768 resolution screen. I would like to be able to wrap the rows to show all the data for each record.

      Not word wrapping, but row wrapping. Does that make sense?
        • 1. Re: DataGrid: row wrap?
          Peter deHaan Level 4
          Something like this?

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical">

          <mx:DataGrid id="dataGrid" width="300" variableRowHeight="true" rowCount="5" rowHeight="20">
          <mx:columns>
          <mx:DataGridColumn dataField="label" wordWrap="true" />
          <mx:DataGridColumn dataField="label" wordWrap="true" />
          </mx:columns>
          <mx:dataProvider>
          <mx:Array>
          <mx:Object label="The quick brown fox jumped over the lazy dog." />
          <mx:Object label="The quick brown fox jumped over the lazy dog." />
          <mx:Object label="The quick brown fox jumped over the lazy dog." />
          </mx:Array>
          </mx:dataProvider>
          </mx:DataGrid>

          </mx:Application>


          Or you literally want column's 1-10 on one line, and columns 11-20 on a different line? If so, you may be able to do this with a custom item renderer (but you may lose sorting), or maybe you can do it with the AdvancedDataGrid control in Flex 3 Professional.

          Peter
          • 2. Re: DataGrid: row wrap?
            Peter deHaan Level 4
            Another option is to scroll the datagrid horizontally (set the DataGrid control's horizontalScrollPolicy to "on"):

            <mx:DataGrid id="dataGrid" width="300" variableRowHeight="true" rowCount="5" rowHeight="20" horizontalScrollPolicy="on" lockedColumnCount="1">
            <mx:columns>
            <mx:DataGridColumn dataField="index" width="40" />
            <mx:DataGridColumn dataField="label" wordWrap="true" width="200" />
            <mx:DataGridColumn dataField="label" wordWrap="true" width="200" />
            </mx:columns>
            <mx:dataProvider>
            <mx:Array>
            <mx:Object index="1" label="The quick brown fox jumped over the lazy dog." />
            <mx:Object index="2" label="The quick brown fox jumped over the lazy dog." />
            <mx:Object index="3" label="The quick brown fox jumped over the lazy dog." />
            </mx:Array>
            </mx:dataProvider>
            </mx:DataGrid>

            Peter
            • 3. DataGrid: row wrap?
              Fauerbach_Consulting Level 1
              Yeah, not word wrap, that ones relatively easily documented.


              quote:

              Or you literally want column's 1-10 on one line, and columns 11-20 on a different line? If so, you may be able to do this with a custom item renderer (but you may lose sorting), or maybe you can do it with the AdvancedDataGrid control in Flex 3 Professional.

              That is exactly literally what I want. Not sure it's possible, or really good to do.



              quote:

              Another option is to scroll the datagrid horizontally (set the DataGrid control's horizontalScrollPolicy to "on"):

              Not to poo poo, onyour idea , but horizontal scrolling isn't an option. it's a personal pet peeve, and I will fight, wrestle, punch, blackmail etc, to avoid a horizontal scroll bar... BUT you are right. it would solve the problem easily.
              • 4. Re: DataGrid: row wrap?
                ntsiii Level 3
                Wrap a row? You would want the headers to wrap also? How would the columns line up? I think you are going to need to think outside the grid on this one.

                Consider using Repeater in an HBox. That gives you unlimited flexibility per row.. You won't get resizable columns or other datagrid stuff, but you will need to decide what is important to you.

                Tracy