Dynamic datagrid column based on rowIndex

I am passing objects into a datagrid that have a rank variable.  Before I place the objects into the datagrid, I sort upon rank so the objects will show in the datagrid sequentially.
What I am wanting to do is be able to drag-and-drop the rows, and I want the rank variable to change depending on which row the object is in.
I thought I had this feature working by setting rank to the dataProvider index when a row is dropped. This does work intially, but gets messed up when a user decides to sort any row in the grid.
Does anyone have any suggestions on how I can get this to work?

I think you can use a labelFunction that considers listData.rowIndex and
owner.verticalScrollPosition.

Similar Messages

  • 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

  • Dynamic lead columns based on chars with compounding

    Hi folk,
    I have char 0WORKCENTER. This char has componding with 0PLANT. Can I build dynamic lead columns based on 0WORKCENTER in the planning format?

    Hi Dmitry,
    it should work as long as 0plant is restricted to a single value (in level or header).
    Regards,
    Marc
    SAP NetWeaver RIG

  • How can i dynamically select columns based on the input parameter?

    I have an input parameter which takes single numeric value.
    Based on this value i have to dynamically select table-columns .
    For eg: if i have following fields in my table :
    SEM_1
    SEM_2
    SEM_3 and SEM_4.
    And if i give numeric input as 2 , then i have to select "SEM_2" column only.
    if the input is 3 then i have to select "SEM_3" only and leave the rest of the columns.
    how do i achieve this dynamic feature in the "Select .....  From...... table...." statement in the ABAP??

    Hi,
    you should try something like this.
    TYPES: cond(72) TYPE c.
    data: condtab TYPE TABLE OF cond,
             condw type cond.
    data: lv_field(30) type c value 'SEM_'.
    write p_num to lv_field+4(1).
    condw = lv_field.
    append condw to condtab.
    SELECT (CONDTAB) FROM table INTO.....
    Kostas
    Message was edited by:
            Kostas Tsioubris

  • Dynamic Link Column Based on Value

    I'm using Apex version 4.1.
    This is driving me nuts, I can't get it to work. I'm trying to create a dynamic link on a column (in a SQL report) based on the value. Here's my query:
    SELECT STRUCTURE_ENTITY_ID AS "Market ID",
    Structure_entity as "Market Name",
    CASE WHEN NVL2((select 'A' from PC_PAYROLL_DISTRIBUTION PD
    WHERE PROCESSING_YEAR = SUBSTR('2011-08',1,4)
    AND PROCESSING_MONTH = TO_NUMBER(SUBSTR('2011-08',6,2))
    AND PD.OPS_MARKET = SE.STRUCTURE_ENTITY_ID
    AND ROWNUM = 1),'Ready','Not Ready') = 'Ready' THEN '' ||'' ELSE 'Not Ready' END AS Status
    FROM STRUCTURE_ENTITY SE
    So when the value in that CASE statement equals 'Ready' then I need it to show the word Ready (in the Status column) as a hyperlink, otherwise it needs to show 'Not Ready' in normal text that's not clickable.
    The URL string I have in there DOES pick up the correct values for my parameters, but it stilll appears in the report as the whole string, and it's not clickable. Any help would be greatly appreciated!
    Thanks,
    Greg

    I see an a instead of <a and no </a> in this code.
    Oh, I guess your {a is <a ... B-)  Still no end tag, though.
    Edited by: InoL on Oct 7, 2011 2:27 PM                                                                                                                                                                                                                                                                                                                       

  • Reading dynamic table column based on user selection

    Hi there,
    I am having a problem of reading and manipulating the data stored in a standard SAP table. The following example simulates the table and what i am trying to do:
    Table: Storing sales data for sales person
    SALES_PERSON    REGION   YEAR   MTH_S1  MTH_S2  MTH_S3 MTH_S4...
    Richard  S               NORTH    2007     100          200         300        400
    John K                    SOUTH    2007      50           100         100        20
    Brad P                    NORTH    2007     300          100         100        50
    User have have the following selection option:
    1. Month.
    The program will calculate the sales based on the individual month selected
    Example, if user select Month = 3, then program take only MTH_S3 column value
    So total sales = 300100100=500
    2. Month range
    The program will calculate the sales based on the month range selected
    Example, if user select Month 2 to 4, then program take MTH 2 to MTH_S4 columns value
    So total sales = 400 (for MTH_S2) + 500 (for MTH_S3) + 470 (for MTH_S4) = 1370
    How should i write the logic or code for this requirement?
    Hope someone can help.
    Thanks,
    Pang HK

    Try something like this
    TABLES:
    t247.
    SELECT-OPTIONS:
      s_month FOR t247-mnr NO-EXTENSION.
    DATA:
      BEGIN OF fs_data,
        person(30),
        area(10),
        year(4),
        mon1 TYPE kbetr,
        mon2 TYPE kbetr,
        mon3 TYPE kbetr,
        mon4 TYPE kbetr,
        mon5 TYPE kbetr,
      END OF fs_data,
      t_data LIKE STANDARD TABLE OF fs_data,
      w_no_months TYPE i,
      w_kbetr TYPE kbetr,
      w_total TYPE kbetr.
      LOOP AT t_data INTO fs_data.
        CLEAR w_kbetr.
        DO 5 TIMES VARYING w_kbetr FROM fs_data-mon1
                                                          NEXT fs_data-mon2.
        IF sy-index IN s_month.
          w_total = w_total + w_kbetr.
        ENDIF.
        ENDDO.
      ENDLOOP.
    change the value 5, according to the no.of months in ur internal table

  • 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

  • Dynamic DataGrid with Preferred columns

    Hi all,
    I want to populate a dynamic DataGrid with User Preferred
    columns (ex : EmpId,First Name and Phone). Each time columns may
    change based on User Selection in Preferences Page so columns
    should not hard code. I'm able to see data for EmpId, First Name
    but I want to see the Inner tag data of "Phone" as a Field.
    Sample XML ....
    <emp>
    <empId>1002</empId>
    <firstName>Smith</firstName>
    <lastName>John</lastName>
    <address>
    <city>Ohio>
    <phone>433-234-322</phone>
    <zip>60003</zip>
    </address>
    </emp>
    Thanks.

    To display nested data, you must use a labelFunction. I have
    several labelFunction examples on cflex.net.
    You can assign a function reference to the column's
    labelFunction property in the column generation code.
    Tracy

  • Dynamic text in a dataGrid column?

    i have a datagrid. i want to populate the first column with a different label depending on the row number.
    A good example of this would be
    Column 1 label
    Label 1
    Label 2
    Label 3
    Label 4
    I have these labels in an array, so i could access them if i had the row number.
    Anyone know how to do this?
    thanks!

    Hi peteandrus,
    You can simply use the code snippet below to display the labels row wise....
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
       <mx:Script>
       <![CDATA[
        import mx.controls.Alert;
          [Bindable]private var myAC:Array = [
             {Column1:'Label 1', Column2:"Text 1"},
             {Column1:'Label 2', Column2:"Text 2"},
             {Column1:'Label 3', Column2:"Text 3"},
             {Column1:'Label 4', Column2:"Text 4"}
       ]]>
       </mx:Script>
    <mx:DataGrid id="dataGrid" dataProvider="{myAC}" x="10" y="177" visible="true">          
      <mx:columns>
       <mx:DataGridColumn  headerText="Column 1 label" dataField="Column1"/>           
       <mx:DataGridColumn dataField="Column2" headerText="Column 2 label" />           
      </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    If you really want to find the row index based assignment you can try something using labelFunction for the DataGrid column...
    Something like below:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
       <mx:Script>
       <![CDATA[
        import mx.controls.dataGridClasses.DataGridColumn;
        import mx.controls.Alert;
        [Bindable]private var myAC:Array = [
      {Column1:'Label 1', Column2:"Text 1"},
            {Column1:'Label 2', Column2:"Text 2"},
            {Column1:'Label 3', Column2:"Text 3"},
            {Column1:'Label 4', Column2:"Text 4"}
    private var counter:int=-1;         
        private function column1LabelFunction(item:Object, coulmn:DataGridColumn):String
         var strLabel:String="";
         counter++;
         if(counter < myAC.length)
          strLabel = myAC[counter].Column1;
      return strLabel;    
       ]]>
       </mx:Script>
    <mx:DataGrid id="dataGrid" dataProvider="{myAC}" x="10" y="177" visible="true">          
      <mx:columns>
       <mx:DataGridColumn  headerText="Column 1 label" labelFunction="column1LabelFunction"/>           
       <mx:DataGridColumn dataField="Column2" headerText="Column 2 label" />           
      </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    Thanks,
    Bhasker Chari

  • Setting the editable property of a datagrid column dynamically

    Hi,
    Im trying to set the editable property and renderer is editable property for a datagrid column to false on the creation complete event of the datagrid.But It does not work.While visible property works.why doesnt the editable property work.The particular column has a renderer which is a text box.and the editable property is set to false initially.Any Suggestions or ideas on how to achieve this will be of great help.

    Eu tenho vontade de estar devidamente por dentro de tudo isso.

  • 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.

  • Grouping of chracateristics by using dynamic data columns

    Hi all,
    I want to create a BPS Layout (BW3.5) with the material in the lead column and a KeyFigures, the year and the salesgroup in the data column. The salesgroup is the dynamic characteristic.
    Example:
    I want to have:
    SG1 2007/   SG1 2008/   SG2 2007/   SG2 2008...
    What the system is doing is:
    SG1 2007/   SG2 2007/   SG1 2008/   SG2 2008
    My question is: how can I change the grouping of the columns from year to salesorg?
    Can anybody help me?
    Best regards,
    Rainer

    Hi Rainer,
    Thanks for your appreciation.
    I thought there is not material in your lead column, okay if your case like that i suggest you like this.
    I suggest to .
    To choose Layout Category:
    1. Key Figures in Data Column
    Define data column dynamically for : Sales Group
    And make the fiscal year, and material as lead column.
    In the data column tab, define the key-figures there and mark Dynamic checkbox.
    Or if you want to group based on the fiscal year, you can make the fiscal year as you dynamic data column.
    Hopefully it can help you a lot.
    Best regards,
    Niel.
    thanks for the points you choose to assign.

  • Hide or show a column based on a parameter?

    I have a parameter that has two values linked to 2 fields and included in my SQL query.  I would like to hide or show columns based on the parameter value chosen for other fields.  How do I begin to write the expression? 

    Hi KittyCat101,
    Based on my understanding, you want to display columns dynamically based on a parameter, right?
    In your scenario, you can specify column visibility for all columns based on the expression which contains selected parameter values. So that if we select a value from the drop-down list of the parameter, the column will display based on the column visibility
    expression. For more information, please refer to this article:
    Conditionally Setting Column Visibility in SSRS.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Header description of dynamic data columns dynamically

    Hi all,
    How is it possible to get Header description of dynamic data columns dynamically??
    Thanks and regards,
    Harry

    Harry,
    Don't have the system right now so going by memory.
    There are 2 parts - you need to see how you specified the text replacement of the variable.  Say on 0fiscper if you specify characteristic value it would show I think 001.2007, 002.2007, etc.  If you use one of the text types, it would be based on the description.
    I always have to think if I need to put the infoobject name or the variable name in the layout definition in the description part.  Off the top of my mind, it would be the infoobject name i.e. 0fiscper for example

  • Dynamic add column in Bex report

    Hi all,
             we have input parameter is month wise. For example if i have input 12.2011 - 03.2012
    Output:
    12.2011--01.2012--02.2012-----04.2012
       50kg -
    70--90--
    54
    Like above dynamically have to change column based on month input parameter. Please guide me how to design bex query.
    Thanks
    Saravanan

    hi,
    restrict calmonth with variable type manual input, and put this calmonth in columns on top of amount or quantity. It will give you your desired output.
    hope this helps,
    regards,
    ray
    Edited by: ray100 on Mar 9, 2012 2:54 PM

Maybe you are looking for