How to align datagrid column

hi,
i want the datagrid headings alone to be aligned as center and rest of the columns to be aligned as left
For example my data grid should look like this
Header 1
Header 2
xxxx
yyyy
xxxx
yyyy
i have used data grid align property, it effects the entire grid. Is there any way......
Thanks in Advance,
Ayathas

Hi Sam
Set the
RightJustify = True
for that column.

Similar Messages

  • How to align ADF column header text

    Hi,
    I want to align ADF column header text to center regardless of whether the contents are text (which should be left aligned - done by the "formatType" attribute) or number (which should be right aligned - done by the "formatType" attribute) within a ADF table. the styleclass attributes also doesnt work. can anybody help me pl?
    Afi

    Hi Afi,
    use
    <af:column>
      <f:facet name="header">
        <af:panelHorizontal halign="center">
          <af:outputText value="#{bindings.DeptView.labels.Dname}"/>
        </af:panelHorizontal>
      </f:facet>
      <af:inputText value="#{row.Dname}"/>
    </af:column>instead of
    <af:column headerText="#{bindings.DeptView.labels.Dname}">
      <af:inputText value="#{row.Dname}"/>
    </af:column>Rado

  • How to align Hgrid column(messagestyledtext) header text to right justified

    Hi All,
    I have a Hgrid table and i am using five columns in hgrid table.. I need to display column header text right justified. but by default it is left justified.
    Can any one tell me how to do it..
    Its very urgent.. Please help me out..
    Regards,
    Babu

    Use
    OAHGridBean GeneralHgrid=(OAHGridBean)webBean.findChildRecursive("<hgrid item name>");
    GeneralHgrid.prepareForRendering(pageContext);
    DataObjectList tableColumnFormats =GeneralHgrid.getColumnFormats();
    DictionaryData tableColumnFormat = (oracle.cabo.ui.data.DictionaryData)tableColumnFormats.getItem(pageContext.findChildIndex(GeneralHgrid, "<item id of item attached in hgrid column>"));
    tableColumnFormat.put(COLUMN_DATA_FORMAT_KEY, <enter format>);
    see below:
    �� TEXT_FORMAT (textFormat)- column content is Start justified.
    �� NUMBER_FORMAT (numberFormat)- column content is Right justified.
    �� ICON_BUTTON_FORMAT (iconButtonFormat)- column content is center justified.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to align Matrix Column?

    I want to align some numeric column to Right Align by default it was left align

    Hi Sam
    Set the
    RightJustify = True
    for that column.

  • How not to sort datagrid column on double click

    Hello,
    I am currently building an application containing a datagrid for data representation. I've created a custom datagridheader in order to add a input text for filtering the columns (see code below).
    My goal is to hide the textinput, and then show it on a double click on the header. So i would like to know how to avoid the sort of this column each time i double click.?
    <?xml version="1.0" encoding="utf-8"?>
    <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                        xmlns:s="library://ns.adobe.com/flex/spark"
                        xmlns:mx="library://ns.adobe.com/flex/mx" resize="onColumnResize(event)" clipAndEnableScrolling="true" doubleClick="managefilterField(event)">
        <fx:Declarations>
            <!--- The default value of the <code>sortIndicator</code> property.
            It must be an IFactory for an IVisualElement.       
            <p>This value is specified in a <code>fx:Declaration</code> block and can be overridden
            by a declaration with <code>id="defaultSortIndicator"</code>
            in an MXML subclass.</p>
            @langversion 3.0
            @playerversion Flash 10
            @playerversion AIR 2.0
            @productversion Flex 4.5
            -->
            <fx:Component id="defaultSortIndicator">
                <s:Path data="M 3.5 7.0 L 0.0 0.0 L 7.0 0.0 L 3.5 7.0" implements="spark.components.gridClasses.IGridVisualElement">
                    <fx:Script>
                        <![CDATA[
                            import spark.components.DataGrid;
                            import spark.components.Grid;
                             *  @private
                            public function prepareGridVisualElement(grid:Grid, rowIndex:int, columnIndex:int):void
                                const dataGrid:DataGrid = grid.dataGrid;
                                if (!dataGrid)
                                    return;
                                const color:uint = dataGrid.getStyle("symbolColor");
                                arrowFill1.color = color;
                                arrowFill2.color = color;
                        ]]>
                    </fx:Script>
                    <s:fill>
                        <s:RadialGradient rotation="90" focalPointRatio="1">   
                            <!--- @private -->
                            <s:GradientEntry id="arrowFill1" color="0" alpha="0.6" />
                            <!--- @private -->
                            <s:GradientEntry id="arrowFill2" color="0" alpha="0.8" />
                        </s:RadialGradient>
                    </s:fill>
                </s:Path>
            </fx:Component>
            <!--- Displays the renderer's label property, which is set to the column's <code>headerText</code>.
            It must be an instance of a <code>TextBase</code>, like <code>s:Label</code>.
            <p>This visual element is added to the <code>labelDisplayGroup</code> by the renderer's
            <code>prepare()</code> method.   Any size/location constraints specified by the labelDisplay
            define its location relative to the labelDisplayGroup.</p>
            <p>This value is specified with a <code>fx:Declaration</code> and can be overridden
            by a declaration with <code>id="labelDisplay"</code>
            in an MXML subclass.</p>
            @langversion 3.0
            @playerversion Flash 10
            @playerversion AIR 2.0
            @productversion Flex 4.5
            -->
            <s:Label id="labelDisplay"
                     verticalCenter="1" left="0" right="0" top="0" bottom="0"
                     textAlign="start"
                     fontWeight="bold"
                     verticalAlign="middle"
                     maxDisplayedLines="1"
                     showTruncationTip="true" />
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import net.awl.ismp.console.components.misc.FilterCriteria;
                import net.awl.ismp.console.events.ColumnFilteredEvent;
                import net.awl.ismp.console.events.ColumnResizedEvent;
                import mx.events.ResizeEvent;
                import spark.components.gridClasses.IGridVisualElement;
                import mx.core.IVisualElement;
                import spark.components.DataGrid;
                import spark.components.GridColumnHeaderGroup;
                import spark.components.gridClasses.GridColumn;
                import spark.primitives.supportClasses.GraphicElement;
                // chrome color constants and variables
                private static const DEFAULT_COLOR_VALUE:uint = 0xCC;
                private static const DEFAULT_COLOR:uint = 0xCCCCCC;
                private static const DEFAULT_SYMBOL_COLOR:uint = 0x000000;
                private static var colorTransform:ColorTransform = new ColorTransform();
                 *  @private
                private function dispatchChangeEvent(type:String):void
                    if (hasEventListener(type))
                        dispatchEvent(new Event(type));                   
                protected function onColumnResize(event:ResizeEvent):void
                    dispatchEvent(new ColumnResizedEvent(ColumnResizedEvent.COLUMNRESIZED_EVT,this.width,this.column.columnInde x));
                //  maxDisplayedLines
                private var _maxDisplayedLines:int = 1;
                [Bindable("maxDisplayedLinesChanged")]
                [Inspectable(minValue="-1")]
                 *  The value of this property is used to initialize the
                 *  <code>maxDisplayedLines</code> property of this renderer's
                 *  <code>labelDisplay</code> element.
                 *  @copy spark.components.supportClasses.TextBase#maxDisplayedLines
                 *  @default 1
                 *  @langversion 3.0
                 *  @playerversion Flash 10
                 *  @playerversion AIR 1.5
                 *  @productversion Flex 4.5
                public function get maxDisplayedLines():int
                    return _maxDisplayedLines;
                override protected function stateChanged(oldState:String, newState:String, recursive:Boolean):void
                    trace("state changed from : "+oldState+" to "+newState);
                    super.stateChanged(oldState, newState, recursive);
                 *  @private
                public function set maxDisplayedLines(value:int):void
                    if (value == _maxDisplayedLines)
                        return;
                    _maxDisplayedLines = value;
                    if (labelDisplay)
                        labelDisplay.maxDisplayedLines = value;
                    invalidateSize();
                    invalidateDisplayList();
                    dispatchChangeEvent("maxDisplayedLinesChanged");
                //  sortIndicator
                private var _sortIndicator:IFactory;
                private var sortIndicatorInstance:IVisualElement;
                [Bindable("sortIndicatorChanged")]
                 *  A visual element that's displayed when the column is sorted.
                 *  <p>The sortIndicator visual element is added to the <code>sortIndicatorGroup</code>
                 *  by this renderer's <code>prepare()</code> method.  Any size/location constraints
                 *  specified by the sortIndicator define its location relative to the sortIndicatorGroup.</p>
                 *  @default null
                 *  @langversion 3.0
                 *  @playerversion Flash 10
                 *  @playerversion AIR 1.5
                 *  @productversion Flex 4.5
                public function get sortIndicator():IFactory
                    return (_sortIndicator) ? _sortIndicator : defaultSortIndicator;
                 *  @private
                public function set sortIndicator(value:IFactory):void
                    trace("setSortIndicator");
                    if (_sortIndicator == value)
                        return;
                    _sortIndicator = value;
                    if (sortIndicatorInstance)
                        sortIndicatorGroup.includeInLayout = false;
                        sortIndicatorGroup.removeElement(sortIndicatorInstance);
                        sortIndicatorInstance = null;
                    invalidateDisplayList();
                    dispatchChangeEvent("sortIndicatorChanged");
                 *  @private
                 *  Create and add the sortIndicator to the sortIndicatorGroup and the
                 *  labelDisplay into the labelDisplayGroup.
                override public function prepare(hasBeenRecycled:Boolean):void
                    trace("prepare !!");
                    super.prepare(hasBeenRecycled);
                    if (labelDisplay && labelDisplayGroup && (labelDisplay.parent != labelDisplayGroup))
                        labelDisplayGroup.removeAllElements();
                        labelDisplayGroup.addElement(labelDisplay);
                    trace(sortIndicator);
                    trace("sortIndicatorInstance : "+sortIndicatorInstance);
                    const column:GridColumn = this.column;
                    if (sortIndicator && column && column.grid && column.grid.dataGrid && column.grid.dataGrid.columnHeaderGroup)
                        const dataGrid:DataGrid = column.grid.dataGrid;
                        const columnHeaderGroup:GridColumnHeaderGroup = dataGrid.columnHeaderGroup;
                        if (columnHeaderGroup.isSortIndicatorVisible(column.columnIndex))
                            if (!sortIndicatorInstance)
                                sortIndicatorInstance = sortIndicator.newInstance();
                                sortIndicatorGroup.addElement(sortIndicatorInstance);
                                chromeColorChanged = true;
                                invalidateDisplayList();
                            // Initialize sortIndicator
                            sortIndicatorInstance.visible = true;
                            const gridVisualElement:IGridVisualElement = sortIndicatorInstance as IGridVisualElement;
                            if (gridVisualElement)
                                gridVisualElement.prepareGridVisualElement(column.grid, -1, column.columnIndex);
                            sortIndicatorGroup.includeInLayout = true;
                            sortIndicatorGroup.scaleY = (column.sortDescending) ? 1 : -1;
                        else
                            if (sortIndicatorInstance)
                                sortIndicatorGroup.removeElement(sortIndicatorInstance);
                                sortIndicatorGroup.includeInLayout = false;
                                sortIndicatorInstance = null;
                private var chromeColorChanged:Boolean = false;
                private var colorized:Boolean = false;
                 *  @private
                 *  Apply chromeColor style.
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                    //trace("update display list");
                    // Apply chrome color
                    if (chromeColorChanged)
                        var chromeColor:uint = getStyle("chromeColor");
                        if (chromeColor != DEFAULT_COLOR || colorized)
                            colorTransform.redOffset = ((chromeColor & (0xFF << 16)) >> 16) - DEFAULT_COLOR_VALUE;
                            colorTransform.greenOffset = ((chromeColor & (0xFF << 8)) >> 8) - DEFAULT_COLOR_VALUE;
                            colorTransform.blueOffset = (chromeColor & 0xFF) - DEFAULT_COLOR_VALUE;
                            colorTransform.alphaMultiplier = alpha;
                            transform.colorTransform = colorTransform;
                            var exclusions:Array = [labelDisplay, sortIndicatorInstance];
                            // Apply inverse colorizing to exclusions
                            if (exclusions && exclusions.length > 0)
                                colorTransform.redOffset = -colorTransform.redOffset;
                                colorTransform.greenOffset = -colorTransform.greenOffset;
                                colorTransform.blueOffset = -colorTransform.blueOffset;
                                for (var i:int = 0; i < exclusions.length; i++)
                                    var exclusionObject:Object = exclusions[i];
                                    if (exclusionObject &&
                                        (exclusionObject is DisplayObject ||
                                            exclusionObject is GraphicElement))
                                        colorTransform.alphaMultiplier = exclusionObject.alpha;
                                        exclusionObject.transform.colorTransform = colorTransform;
                            colorized = true;
                        chromeColorChanged = false;
                    super.updateDisplayList(unscaledWidth, unscaledHeight);
                 *  @private
                override public function styleChanged(styleProp:String):void
                    var allStyles:Boolean = !styleProp || styleProp == "styleName";
                    super.styleChanged(styleProp);
                    if (allStyles || styleProp == "chromeColor")
                        chromeColorChanged = true;
                        invalidateDisplayList();
                protected function managefilterField(event:MouseEvent):void
                    trace("double click sortIndicator : "+this.sortIndicatorInstance);
                    this.filterInput.visible=!this.filterInput.visible;
                    this.filterInput.includeInLayout=this.filterInput.visible;
                    this.filterSpacer.visible=this.filterInput.visible;
                    this.filterSpacer.includeInLayout=this.filterInput.visible;
                    if(!this.filterInput.visible)
                        this.filterInput.text="";
                        dispatchEvent(new ColumnFilteredEvent(ColumnFilteredEvent.COLUMNFILTERED_EVT,new FilterCriteria(this.column.dataField,this.filterInput.text)));
                    this.filterInput.setStyle("borderColor",0xFF6319);
                    this.filterInput.setStyle("focusColor",0xFF6319);
                    //this.filterInput.setStyle(
                protected function onTextInputSelection(event:MouseEvent):void
                    event.stopImmediatePropagation();
                    this.filterInput.setStyle("borderColor",0xFF6319);
                    this.filterInput.setStyle("focusColor",0xFF6319);
                protected function onKeyUp(event:KeyboardEvent):void
                    if(event.charCode==Keyboard.ENTER)
                        stage.focus=null;
                protected function onFocusOut(event:FocusEvent):void
                    this.filterInput.setStyle("borderColor",0x00ff00);
                    this.filterInput.setStyle("focusColor",0x70B2EE);
                    dispatchEvent(new ColumnFilteredEvent(ColumnFilteredEvent.COLUMNFILTERED_EVT,new FilterCriteria(this.column.dataField,this.filterInput.text)));
            ]]>
        </fx:Script>
        <s:states>
            <s:State name="normal" />
            <s:State name="hovered" />
            <s:State name="down" />
        </s:states>     
        <!-- layer 1: shadow -->
        <!--- @private -->
        <s:Rect id="shadow" left="-1" right="-1" top="-1" bottom="-1" radiusX="2">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="0x000000"
                                     color.down="0xFFFFFF"
                                     alpha="0.01"
                                     alpha.down="0" />
                    <s:GradientEntry color="0x000000"
                                     color.down="0xFFFFFF"
                                     alpha="0.07"
                                     alpha.down="0.5" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>
        <!-- layer 2: fill -->
        <!--- @private -->
        <s:Rect id="fill" left="0" right="0" top="0" bottom="0">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="0xFFFFFF"
                                     color.hovered="0xBBBDBD"
                                     color.down="0xAAAAAA"
                                     alpha="0.85" />
                    <s:GradientEntry color="0xD8D8D8"
                                     color.hovered="0x9FA0A1"
                                     color.down="0x929496"
                                     alpha="0.85" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>
        <!-- layer 3: fill lowlight -->
        <!--- @private -->
        <s:Rect id="lowlight" left="0" right="0" top="0" bottom="0">
            <s:fill>
                <s:LinearGradient rotation="270">
                    <s:GradientEntry color="0x000000" ratio="0.0" alpha="0.0627" />
                    <s:GradientEntry color="0x000000" ratio="0.48" alpha="0.0099" />
                    <s:GradientEntry color="0x000000" ratio="0.48001" alpha="0" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>
        <!-- layer 4: fill highlight -->
        <!--- @private -->
        <s:Rect id="highlight" left="0" right="0" top="0" bottom="0">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="0xFFFFFF"
                                     ratio="0.0"
                                     alpha="0.33"
                                     alpha.hovered="0.22"
                                     alpha.down="0.12"/>
                    <s:GradientEntry color="0xFFFFFF"
                                     ratio="0.48"
                                     alpha="0.33"
                                     alpha.hovered="0.22"
                                     alpha.down="0.12" />
                    <s:GradientEntry color="0xFFFFFF"
                                     ratio="0.48001"
                                     alpha="0" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect> 
        <!-- layer 5: highlight stroke (all states except down) -->
        <!--- @private -->
        <s:Rect id="highlightStroke" left="0" right="0" top="0" bottom="0" excludeFrom="down">
            <s:stroke>
                <s:LinearGradientStroke rotation="90" weight="1">
                    <s:GradientEntry color="0xFFFFFF" alpha.hovered="0.22" />
                    <s:GradientEntry color="0xD8D8D8" alpha.hovered="0.22" />
                </s:LinearGradientStroke>
            </s:stroke>
        </s:Rect>
        <!-- layer 6: highlight stroke (down state only) -->
        <!--- @private -->
        <s:Rect id="hldownstroke1" left="0" right="0" top="0" bottom="0" includeIn="down">
            <s:stroke>
                <s:LinearGradientStroke rotation="90" weight="1">
                    <s:GradientEntry color="0x000000" alpha="0.25" ratio="0.0" />
                    <s:GradientEntry color="0x000000" alpha="0.25" ratio="0.001" />
                    <s:GradientEntry color="0x000000" alpha="0.07" ratio="0.0011" />
                    <s:GradientEntry color="0x000000" alpha="0.07" ratio="0.965" />
                    <s:GradientEntry color="0x000000" alpha="0.00" ratio="0.9651" />
                </s:LinearGradientStroke>
            </s:stroke>
        </s:Rect>
        <!--- @private -->
        <s:Rect id="hldownstroke2" left="1" right="1" top="1" bottom="1" includeIn="down">
            <s:stroke>
                <s:LinearGradientStroke rotation="90" weight="1">
                    <s:GradientEntry color="0x000000" alpha="0.09" ratio="0.0" />
                    <s:GradientEntry color="0x000000" alpha="0.00" ratio="0.0001" />
                </s:LinearGradientStroke>
            </s:stroke>
        </s:Rect>
        <!--<s:Rect id="fill" left="0" right="0" top="0" bottom="0">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color.normal="0xf9f9f9" color.hovered="0xfcfdfa"
                                     color.down="0xdceac2" alpha="0.85" />
                    <s:GradientEntry color.normal="0xeaeaea" color.hovered="0xdceac2"
                                     color.down="0xd2e1b5" alpha="0.85" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>-->
        <!--<s:VGroup left="7" right="7" top="5" bottom="5" gap="6" verticalAlign="middle">
            <s:TextInput width="100%" />
            <s:HGroup width="100%">
                <s:Group id="labelDisplayGroup" width="100%" />
                <s:Group id="sortIndicatorGroup" includeInLayout="false" />
            </s:HGroup>
        </s:VGroup>-->
        <s:VGroup verticalAlign="middle" left="7" top="5" right="7" bottom="5" gap="2" >
            <s:TextInput id="filterInput" width="100%" visible="false" includeInLayout="false" keyUp="onKeyUp(event)" focusOut="onFocusOut(event)" click="onTextInputSelection(event)"/>
            <s:Spacer id="filterSpacer" visible="false" includeInLayout="false" height="5" />
        <s:HGroup width="100%" height="100%" verticalAlign="middle">
            <s:Group id="labelDisplayGroup" width="100%" />
            <s:Group id="sortIndicatorGroup" includeInLayout="false" />
        </s:HGroup>
        </s:VGroup>
    </s:GridItemRenderer>

    Based on your idea, i've intercepted the click event and I use stopImmediatePropagation.
    THen i added an image to sort the column. So if the image is clicked the sort is ok.

  • How to bind each DataGrid column separately?

    Good day fellow Flex developers!
    Could you please help me out. I am trying to figure out how to bind each DataGrid column separately. I need to bind each column to a separate bindable array variable. Is there a dataProvider property for each DataGridColumn???
    Thanks in advance,
    Eugene

    hopefully nope
    just imagine code complexity for that feature?
    how would you think should behave DataGrid when you'll populate your separate arrays with variable items number each?
    all you are able and should do is to build composite dataProvider source, join all your separate arrays into it, this is your responsibility.
    If you feel this message answers your question or helps, please mark it respectively

  • How do I show an image in a DataGrid column?

    I'm not sure that this is possible. I would like to show an
    image in a datagrid column based on the data that the grid is bound
    to. Is there any way to do this? I'm using Beta 3.
    Thanks!

    Yes, you need a custom itemRenderer. This can be inline or a
    custom class.
    Tracy

  • WPF: How to make the Column and Row separator more wide and different color in datagrid?

    Our application uses WPF.
    One of request is make the DataGrid column separator and row separator more wide and use different color and remove original black separator of rows and columns.
    Which template we need to modify to make it? Thx!
    JaneC

    Hi Magnus,
    Thanks for replying our question and provide your suggestions!
    Now we know modify both HorizontalGridLinesBrush and VerticalGridLinesBrush we can change the DataGrid cell separator color.
    Following your suggested, we modify the DataGridCell as following:
    <Style x:Key="Body_Content_DataGrid_Centering"
    TargetType="{x:Type DataGridCell}">
    <Setter Property="Padding" Value="2,0" />
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridCell}">
    <Border BorderThickness="2" BorderBrush="{StaticResource PageBorderBackground}" Margin="-1">
    <Grid Background="{TemplateBinding Background}" VerticalAlignment="Center" Height="42">
    <ContentPresenter VerticalAlignment="Center"/>
    </Grid>
    </Border>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    <Style x:Key="DataGridStyle1" TargetType="{x:Type DataGrid}">
    <Setter Property="HorizontalGridLinesBrush" Value="{x:Null}"/>
    <Setter Property="VerticalGridLinesBrush" Value="{x:Null}"/>
    </Style
    JaneC

  • How to make spark datagrid columns to behave like mx datagrid columns

    Hello.
    I have a problem with spark datagrid component. I can't force spark datagrid columns behave like old mx datagrid columns. In mx datagrid columns fills 100% of datagrid regardles of resizing column or datagrid itself (it will not show horizontal scrolling bar). In spark datagrid last column (colC) will never word wrap, event after setting horizontalScrollPolicy=off. I would like to somehow constrain spark columns to behave like mx ones.
    App snippet (try to resize app and columns - especially colC - and you will see what I mean):
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Declarations>
            <s:ArrayCollection id="dp">
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
            </s:ArrayCollection>
        </fx:Declarations>
        <s:layout>
            <s:HorizontalLayout/>
        </s:layout>
        <s:DataGrid id="grid" width="100%" height="100%" dataProvider="{dp}" variableRowHeight="true" horizontalScrollPolicy="off">
            <s:columns>
                <s:ArrayList>
                    <s:GridColumn headerText="Column A" dataField="colA"/>
                    <s:GridColumn headerText="Column B" dataField="colB"/>
                    <s:GridColumn headerText="Column C" dataField="colC"/>
                </s:ArrayList>
            </s:columns>
        </s:DataGrid>
        <mx:DataGrid id="grid2" width="100%" height="100%" dataProvider="{dp}" wordWrap="true" variableRowHeight="true">
            <mx:columns>
                <mx:DataGridColumn headerText="Column A" dataField="colA"/>
                <mx:DataGridColumn headerText="Column B" dataField="colB"/>
                <mx:DataGridColumn headerText="Column C" dataField="colC"/>
            </mx:columns>
        </mx:DataGrid>
    </s:Application>

    the datagrid has sortItems and sortItemsOn methods you can use.

  • For SAPscript INCLUDE TEXT, how to align as Paragraph format

    Hi experts and ABAP colleagues!
    Need your help on this sapscript problem:
    How to align texts taken from "INCLUDE TEXT" in SAPscript, according to tab defined in Paragraph Format?
    For example, I defined BG to have tabstop at the 2nd column (or equivalent to 1st tab position) where I need to print the text, and then declared it in SE71 like below:
    However the text prints at the leftmost instead of at the 2nd col position - (8th char tab defined in par. format BG).  Hence it is not aligned to its proper heading.  Line Number instead of Description - which is not okay for client view that needs these Thai texts. 
    The technical details I included below.  Kindly examine:
    1.)  Window >Main > Text Element > Include Text command
    /E   ITEM_TEXT
    BG   ,,&TTXIT-TDTEXT&
    /:   INCLUDE &T166P-TXNAM& OBJECT &T166P-TDOBJECT& ID &T166P-TDID&
    /:   NEW-PARAGRAPH BG
    Note:  I used command "NEW-PARAGRAPH" and had exactly the above code in se71.  Anything missed here?  Pls. help.  Thanks.
    #2.) Paragraph Format > Tab
    No. -
      Tab Position -
    Alignment
    1            8,00 CH            LEFT
    2            28,00 CH          CENTER
    etc.
    Note:   and then i put in  ",,&TTXIT-TDTEXT&" (see above) with the 2 comma's beforehand to say that its on the 1st tab or at the 8th character where it should be printed, but does not give intended result... pls help.
    #3.) Paragraph Formats > Standard Attributes
    Left Margin - 0 cm
    Alignment - Left
    no blank lines checkbox - ticked
    Note:  Is there any more attribute i can manipulate from here to force display at the right position?
    Thank you so much in advance for all your help.  Our project team will really appreciate it.  May the Lord bless you as we go through our SAP work!
    Sincerely,
    Celeste

    Here's a thought, instead of using tabs, try writing a method that takes a string that is the starting string, a pad character, and a length and returns a string padded to that length with the specified character.
    public String padR(String src, String padChar, int len)
        // ... You get to fill in the rest suggestion try to do it without a loop
    }Have fun,
    PS.

  • Need help adding image to datagrid column

    Hi,
    Can anyone tell me how to add an image to a datagrid column?
    I have created a flex library project which contains a mxml component with a datagrid, an item renderer mxml component which rendered the image within the datagrid column depending on the value coming back from the database for that column and a folder 'assets' which hold all the images. When I add the library to my main project and call the mxml component with the datagrid an image place holder is visible in the datagrid column but not the image. However, if I take the image out of the library project and added to an 'assets' folder in the main project the image is displayed in the datagrid column.
    It looks like, even though the images are in the flex library project and only the flex library project is trying to display the images in the datagrid, the library project is looking in the main application project folder for the image.
    Does anyone know why this is happening and how to fix it?
    Thanks in advance for an help,
    Xander.

    I have tried embedding the images in my library but it still didn't work. Also I can't embed the image as I'm using the value of the column to complete the image name, for example in my mxml item renderer component I have the added the following code
    <mx:Image source="@Embed(source='assets/' + data.mycolumnvalue + '.png')" tooltip="{data.mycolumnvalue}"/>
    but nothing is displayed.

  • Changing a datagrid column image according to the datagrid column value

    Flash Builder 4.5 / SDK 4.5.1.
    Fairly new to Flash Builder & Flex
    Application targets tablets so it's a "mobile" project.
    Been beating my head up against the wall on trying to figure out how to do this. Watched videos on Lynda.com.  Read Adobe "docs" till my eyes glaze over.  Takes me about 2 lines of code in my corresponding .NET project doing the same thing.....
    Tried numerous examples.  Inline rendering, external rendering files per the examples.
    I have a response field in the database and corresponding column in the s:datagrid.  If the "reportInfoResponse" field is null (not answered), show an image with a question mark.  If yes show an image with "Yes" on it.  Same for a no answer.
    I get errors of:
    1120:Access of undefined property negativeAnswer.
    1120:Access of undefined property affirmativeAnswer
    1120:Access of undefined property reportInfoResponse
    1120:Access of undefined property showResponseImage
    If I put this in an external rendering file I also get an error where it can't access the datafield (reportInfoResponse).  I've tried data.reportInfoResponse, {data.reportInfoResponse}, {reportInfoResponse} and just plain reportInfoResponse the external rendering file with no luck.  I've tried single and double quotes around Y and N.  According to all the examples (not to say there aren't more!), I should be able to reference data.reportInfoResponse in the external file and things should be fine.  Of course, the examples are bare bones code and I don't have a clue if any importing of classes or other items need to take place.  I never see any references of such.  The examples also show the image embedding and changing the image by using imageID.source=...  In my code it tells me it can't find it.
    I have put (ERROR HERE...) on the lines where I'm getting the error messages.  I've eliminated a lot of database scripting and such cause that's all working. 
    Any and all suggestions would be appreciated as I'm pulling out what little hair I have left.......and that's not much at my age........  And yes, I probably could do it by just show text in the column, but that's not what the customer wants... There are other columns I need to do this for so I figure if I can get 1 done and working, the rest are a snap.  I CAN use inline or external rendering to show an image.  It's the changing it that is the catch.........
    Thanks in advance!
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    creationComplete="onCreationComplete()"
    title="{whichCategoryName} > {whichSubCatName} > Questions">
    <fx:Script>
    <![CDATA[
    import com.adobe.serializers.utility.TypeUtility;
    import flash.data.SQLConnection;
    import flash.data.SQLMode;
    import flash.data.SQLResult;
    import flash.events.StatusEvent;
    import flash.filesystem.File;
    import flash.net.URLRequest;
    import flash.net.URLVariables;
    import flash.net.navigateToURL;
    import flashx.textLayout.tlf_internal;
    import mx.collections.ArrayCollection;
    import mx.core.BitmapAsset;
    import mx.events.FlexEvent;
    import spark.events.GridEvent;
    import spark.events.IndexChangeEvent;
    ...(lots of database coding left out here)
    <s:DataGrid id="showQuestions" width="100%" height="100%"
    creationComplete="Grid_creationCompleteHandler(event)" fontFamily="_sans"
    gridClick="gridClickEvent(event);" horizontalScrollPolicy="off"
    selectionColor="#8AD8EF" selectionMode="singleRow" sortableColumns="false"
    variableRowHeight="true" verticalCenter="middle">
    <s:columns>
    <s:ArrayList>
    <s:GridColumn visible="false" dataField="id_report" headerText="id_report" resizable="true" sortable="false"></s:GridColumn>
    <s:GridColumn visible="false" dataField="id_question" headerText="id_question" resizable="true" sortable="false"></s:GridColumn>
    <s:GridColumn id="col_reponse" visible="true" dataField="reportInfoResponse" headerText="Response" resizable="true" sortable="false">
    <s:itemRenderer>
    <fx:Component>
    <s:GridItemRenderer>
    <fx:Script>
    <![CDATA[
    [Embed(source="assets/unknown.png")]
    [Bindable]
    public var unknownAnswer:Class;
    [Embed(source="assets/yes.png")]
    [Bindable]
    public var affirmativeAnswer:Class;
    [Embed(source="assets/no.png")]
    [Bindable]
    public var negativeAnswer:Class;
    (ERROR HERE - 1120:Access of undefined property reportInfoResponse)
    if(reportInfoResponse == "Y")
    (ERROR HERE - 1120:Access of undefined property showResponseImage)
    showResponseImage.source = affirmativeAnswer;
    (ERROR HERE - 1120:Access of undefined property reportInfoResponse)
    if (reportInfoResponse == "N")
    (ERROR HERE - 1120:Access of undefined property showResponseImage)
    showResponseImage.source = negativeAnswer;
    ]]>
    </fx:Script>
    <s:Image id="showResponseImage" source="{unknownAnswer}" verticalCenter="0" horizontalCenter="0"/>
    </s:GridItemRenderer>
    </fx:Component>
    </s:itemRenderer>
    </s:GridColumn>
    <s:GridColumn id="col_question" visible="true" dataField="question" headerText="Question" resizable="true" sortable="false"></s:GridColumn>
    </s:ArrayList>
    </s:columns>
    <s:AsyncListView list="{showTheseQuestions}"/>
    </s:DataGrid>
    </s:View>

    Ioan Thanks for the reply.
    Probably my previous explanation of the problem was a little incomplete. Let me give a better description.
    The situation is something like this.
    I have a requirement in which the customer wants the column header to reflect the 'keep filter value' restriction that he does dynamically in the query report.
    i.e:
    -- usually the kf column header shows 'sales volume'
    -- column header with text variable of the Calender year / month variable -- 'sales volume for 2000 oct'
    -- but when the report is run, if the user wants to go and change the filter:   calender year / month > rt clk > keep filer value > select Jan 2003.
      The kf column header still shows 'Sales Volume 2000 Oct'
    How to make the column header change to 'sales volume for Jan  2003' ?
    Any suggestions greatly appreciated.
    Thanks,

  • How to make Multiple column listbox in CS4 using tree view

    Hi ,
    I am a beginer in Indesign Cs4 plug-in creation.In one scenario i want to create multiple column listbox,i tried with one cloumn using tree view and that is working fine.so suggest how to create multiple column listbox using tree view.
    thanks
    Arun

    InDesign does not have a native multi-column widget. You have three options:
    1) Use the treeview widget and align your widgets in the tree node to create the illusion of columns (stroke panel is an example - the Links panel in CS4 is a better example)
    2) Go the way of the CellPanel SDK example and tweek it to work like a listbox
    3) Create the User Interface in Flex

  • Dynamic DataGrid columns

    How can I get this example to wok with <mx:HTTPService>
    insead of the inline <mx:XML> ?
    Dynamic DataGrid columns
    Example of how to dynamically create DataGridColumns
    A completely dynamic DataGrid example.
    This example uses the xml from the Flexstore example. It
    examines the first product node and uses that to create the
    definitions for the columns. There is some example logic to change
    the columns properties.
    It then instantiates the GataGrid and its columns array,
    assigns the properties, and then the dataProvider, and then adds
    the dataGrid to the application container.
    The example is fully self-contained, since a portion of the
    catalog.xml file is included in the mxml.
    <?xml version="1.0" encoding="utf-8"?>
    <!-- This example uses the dataProvider to build the
    dataGrid columns dynamically -->
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="initApp()">
    <mx:Script><![CDATA[
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.controls.DataGrid;
    import mx.collections.XMLListCollection;
    import mx.controls.Alert;
    [Bindable]
    private var _xlcCatalog:XMLListCollection; //the
    dataProvider for the DG
    //run by creationComplete
    public function initApp():void
    _xlcCatalog = new XMLListCollection(xmlCatalog.product);
    //wrap the XML product nodes in an XMLListCollection
    buildDG(); //creates the dataGrid
    }//initApp
    private function buildDG():void
    var aColumnDef:Array = getColumnDefArray(); //returns a
    noraml array of objects that specify DtaGridColumn properties
    var oColumnDef:Object;
    var dg:DataGrid = new DataGrid; //instantiate a new DataGrid
    var dgc:DataGridColumn;
    var aColumnsNew:Array = dg.columns
    var iTotalDGWidth:int = 0;
    for (var i:int=0;i<aColumnDef.length;i++) { //loop over
    the column definition array
    oColumnDef = aColumnDef
    dgc = new DataGridColumn(); //instantiate a new
    DataGridColumn
    dgc.dataField = oColumnDef.dataField; //start setting the
    properties from the column def array
    dgc.width = oColumnDef.width;
    iTotalDGWidth += dgc.width; //add up the column widths
    dgc.editable = oColumnDef.editable;
    dgc.sortable = oColumnDef.sortable
    dgc.visible = oColumnDef.visible;
    dgc.wordWrap = oColumnDef.wordWrap;
    aColumnsNew.push(dgc) //push the new dataGridColumn onto the
    array
    dg.columns = aColumnsNew; //assign the array back to the
    dtaGrid
    dg.editable = true;
    dg.width = iTotalDGWidth;
    dg.dataProvider = _xlcCatalog; //set the dataProvider
    this.addChild(dg); //add the dataGrid to the application
    }//buildDG
    //uses the first product node to define the columns
    private function getColumnDefArray():Array
    //Alert.show("colcount:" + xmlCatalog.toXMLString());
    var aColumns:Array = new Array();
    var node0:XML = xmlCatalog.product[0]; //get the first
    "product" node
    var xlColumns:XMLList = node0.children(); //get its child
    nodes (columns) as an XMLList
    var xmlColumn:XML
    var oColumnDef:Object;
    for (var i:int=0;i<xlColumns.length();i++) { //loop over
    the xmlList
    xmlColumn = xlColumns;
    oColumnDef = new Object();
    oColumnDef.dataField = xmlColumn.localName(); //make the
    dataField be the node name
    switch (oColumnDef.dataField) { //conditional column
    property logic
    case "name":
    oColumnDef.width = 80;
    oColumnDef.sortable = false;
    oColumnDef.visible = true;
    oColumnDef.editable = false;
    oColumnDef.wordWrap = false;
    break;
    case "description":
    oColumnDef.width = 200;
    oColumnDef.sortable = false;
    oColumnDef.visible = true;
    oColumnDef.editable = false;
    oColumnDef.wordWrap = true;
    break;
    case "price":
    oColumnDef.width = 40;
    oColumnDef.sortable = true;
    oColumnDef.visible = true;
    oColumnDef.editable = true;
    oColumnDef.wordWrap = false;
    break;
    case "image":
    oColumnDef.width = 100;
    oColumnDef.sortable = false;
    oColumnDef.visible = false;
    oColumnDef.editable = false;
    oColumnDef.wordWrap = false;
    break;
    default:
    oColumnDef.width = 50;
    oColumnDef.sortable = true;
    oColumnDef.visible = true;
    oColumnDef.editable = false;
    oColumnDef.wordWrap = false;
    break;
    aColumns.push(oColumnDef);
    return aColumns; //return the array
    }//getColumnDefArray
    ]]></mx:Script>
    <mx:XML id="xmlCatalog">
    <catalog>
    <product productId="1">
    <name>Nokia 6010</name>
    <description>Easy to use without sacrificing style,
    the Nokia 6010 phone offers functional voice communication
    supported by text messaging, multimedia messaging, mobile internet,
    games and more</description>
    <price>99.99</price>
    <image>assets/pic/Nokia_6010.gif</image>
    <series>6000</series>
    <triband>false</triband>
    <camera>false</camera>
    <video>false</video>
    <highlight1>MMS</highlight1>
    <highlight2>Large color display</highlight2>
    </product>
    <product productId="2">
    <name>Nokia 3100 Blue</name>
    <description>Light up the night with a
    glow-in-the-dark cover - when it's charged with light you can
    easily find your phone in the dark. When you get a call, the Nokia
    3100 phone flashes in tune with your ringing tone. And when you
    snap on a Nokia Xpress-on™ gaming cover*, you'll get
    luminescent light effects in time to the gaming
    action.</description>
    <price>139</price>
    <image>assets/pic/Nokia_3100_blue.gif</image>
    <series>3000</series>
    <triband>true</triband>
    <camera>false</camera>
    <video>false</video>
    <highlight1>Glow-in-the-dark</highlight1>
    <highlight2>Flashing lights</highlight2>
    </product>
    <product productId="3">
    <name>Nokia 3100 Pink</name>
    <description>Light up the night with a
    glow-in-the-dark cover - when it's charged with light you can
    easily find your phone in the dark. When you get a call, the Nokia
    3100 phone flashes in tune with your ringing tone. And when you
    snap on a Nokia Xpress-on™ gaming cover*, you'll get
    luminescent light effects in time to the gaming
    action.</description>
    <price>139</price>
    <image>assets/pic/Nokia_3100_pink.gif</image>
    <series>3000</series>
    <triband>true</triband>
    <camera>false</camera>
    <video>false</video>
    <highlight1>Glow-in-the-dark</highlight1>
    <highlight2>Flashing lights</highlight2>
    </product>
    <product productId="4">
    <name>Nokia 3120</name>
    <description>Designed for both business and pleasure,
    the elegant Nokia 3120 phone offers a pleasing mix of features.
    Enclosed within its chic, compact body, you will discover the
    benefits of tri-band compatibility, a color screen, MMS, XHTML
    browsing, cheerful screensavers, and much more.</description>
    <price>159.99</price>
    <image>assets/pic/Nokia_3120.gif</image>
    <series>3000</series>
    <triband>true</triband>
    <camera>false</camera>
    <video>false</video>
    <highlight1>Multimedia messaging</highlight1>
    <highlight2>Animated screensavers</highlight2>
    </product>
    <product productId="5">
    <name>Nokia 3220</name>
    <description>The Nokia 3220 phone is a fresh new cut
    on some familiar ideas - animate your MMS messages with cute
    characters, see the music with lights that flash in time with your
    ringing tone, download wallpapers and screensavers with matching
    color schemes for the interface.</description>
    <price>159.99</price>
    <image>assets/pic/Nokia_3220.gif</image>
    <series>3000</series>
    <triband>false</triband>
    <camera>true</camera>
    <video>false</video>
    <highlight1>MIDI tones</highlight1>
    <highlight2>Cut-out covers</highlight2>
    </product>
    </catalog>
    </mx:XML>
    </mx:Application>

    It should work the same way.
    What problem are you having?
    Tracy

  • DataGrid: column width to content

    Hi all.
    I have some DataGrid, filled from array or from external
    source - it's not matter.
    Headers of columns can have different length, and I need to
    implement columns resizing depends of header length.
    I understand, that I must use some custom headerRenderer, but
    I am flex newbie and have not used renderers earlier, so my test
    was not sucessfull.
    I've configired my DataGrid as in the attached code..
    and how must I implement my renderer? should I override "set
    data function" or some other method?
    how can I get header lentgh in pixels?
    and then how can I set column width?
    Thanks and best regards.

    Should I use a Label, or I need another component?
    For example, can I use such renderer format?

Maybe you are looking for