Add datagrid column values

hello every one.
this is IBRAN, i am using datagrid in my flex application now i want to add only one column data and i want to display it in textinput,
please help me i am trying this from last 7 days please please help me,
this is my datagrid that how i defined-
<mx:DataGrid id="neworderdetails" width="839" height="400" editable="true" visible="false" itemClick="editablefunc(event)" variableRowHeight="true"
                                                   draggableColumns="false" sortableColumns="false" >
                              <mx:columns>
                                        <mx:DataGridColumn headerText="Product Barcode" dataField="ABarcode"/>
                                        <mx:DataGridColumn headerText="Product Description" dataField="BDescription"/>
                                        <mx:DataGridColumn headerText="Ordering Quantity" dataField="COrderingQty"/>
                                        <mx:DataGridColumn headerText="Max Quantity" dataField="DMaxQty"/>
                                        <mx:DataGridColumn headerText="Current Quantity" dataField="ECurrentQty"/>
                                        <mx:DataGridColumn headerText="Cost" dataField="FCost"/>
                                        <mx:DataGridColumn headerText="MRP" dataField="GMrp"/>
                                        <mx:DataGridColumn headerText="Total Discount" dataField="HDiscount"/>
                                        <mx:DataGridColumn headerText="VAT" dataField="IVat"/>
                                        <mx:DataGridColumn headerText="Amount"  dataField="GAmount" labelFunction="{Amount}"/>
                              </mx:columns>
                    </mx:DataGrid>
and one more thing, I am using labelFunction Amount i am calculating amount by multiplying two columns of datagrid this is working fine
now i want to add the only Amount column values one by one and i want to display result as total amount in one textInput.
please please help me for this problem.
thank you.

Hey
to get the multiple selected row use the property datagrid.selectedindices this will return a string with all the selected index with (,) separated .
then get the data of selcted index and put it in to database.
regards.
gajanan hiroji | [email protected] | www.isacglobal.com

Similar Messages

  • Sum datagrid column values

    I am looking for a way (action script code?) to sum datagrid
    column values.
    I am using Flex2 with Cold Fusion MX7.
    I populate a DataGrid by setting dataprovider to the result
    of a Coldfusion query.
    (this.masterList.dataProvider = event.result as
    ArrayCollection;)
    This all works fine.
    The masterList datagrid has debit, credit, and unitcost
    columns. I want to sum those columns individually, and display the
    results in text boxes in another panel.
    I could run a Coldfusion query to return the sums, but would
    like to do it on the client side with action script.
    I want to sum them everytime I update the datagrid, so need
    action code that I can put in the result function.
    I am new to ActionScript, and not sure how to loop through
    the array collection(and/or) dataprovider and sum the items.
    Any help would be appreciated.
    Thanks.

    Loop through your array..if the arrayCollection was named
    myArray;
    private sumFunction():Number{
    var sum:Number=0;
    for(var i:uint=0;i<myArray.lenght;i++){
    sum+=myArray
    .debitValue;
    return sum;

  • How to add one column value with grand total

    hi,
    this is my perform.i am just here multipling  menge and gpres value and stores into G_total variable and displing into output.
    this is my output in main window.
    ex:mat. 1           77.00(g_total value)
        mat  2             55.00(g_total value)
    now the requirement is to add the column and display the output as grand total ex: 77.00 +55.00 = 132.00
    how to do the syntax please help me......???
    FORM get_total  TABLES   in_tab STRUCTURE itcsy
                              out_tab STRUCTURE itcsy.
      DATA: lv_menge(20),
            lv_gpreis(20),
            g_total(20),
            g_total1(20).
      DATA:lc1 TYPE string,
           lc2 TYPE string,
          ls_tab      TYPE itcsy,
         l_tabix        TYPE sy-tabix.
      READ TABLE in_tab WITH KEY name = 'RESBD-MENGE'.
      IF sy-subrc EQ 0.
        lv_menge = in_tab-value.
      ENDIF.
      READ TABLE in_tab WITH KEY name = 'RESBD-GPREIS'.
      IF sy-subrc EQ 0.
        lv_gpreis = in_tab-value.
      ENDIF.
      REPLACE  ',' INTO  lv_gpreis WITH ''.
      CONDENSE lv_gpreis NO-GAPS.
      READ TABLE out_tab WITH KEY name = 'G_TOTAL'.
      IF sy-subrc EQ 0.
        g_total = lv_menge * lv_gpreis.
        out_tab-value = g_total.
        CONDENSE g_total.
        lc1 = g_total+0(2).
        lc2 = g_total+2(3).
        CONCATENATE lc1  lc2  INTO g_total SEPARATED BY ','.
        out_tab-value = g_total.
    CLEAR ls_tab.
        LOOP AT out_tab INTO ls_tab.
          l_tabix = sy-tabix.
          CASE ls_tab-name.
            WHEN 'G_TOTAL'.
              ls_tab-value = G_TOTAL.
          MODIFY out_tab FROM ls_tab INDEX l_tabix.
    ENDCASE.
        ENDLOOP.

    >
    asissahu wrote:
    > hi.
    >
    > nobody is replying my question???
    >
    > please help me
    Hi, Asissahu
    Because may be some one have problem to read your code
    Please have a look at the following link and past code this way.
    [How to post code in SCN|How to post code in SCN, and some things NOT to do...;
    @Naga Please you too
    Regards,
    Faisal

  • Datagrid column value

    How do I iterate over each row and then the columns of the
    datagrid?
    I populate the datagrid columns through an actionscript
    function (on click of a button and using datagrid.addItem()
    method). So my dataprovider is not an arraycollection or from xml
    or whatever.

    DataGrid does not have an "addItem()" method.
    Are you using Flex 1.5?
    Show us the code where you are doing this.
    Tracy

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

  • If myText.text == any value in a datagrid column

    Hey guys, in a simple form, I am trying to achieve what's in my title.
    I have a text box in which you type in a value (number).
    I have a submit button which inserts the value into my data-grid which  is populated by a data provider to display that information (ZendAMF).
    For my submit button function I need it to loop through all the  values(rows) in a column (my dataprovider) of my data-grid to check if my text box value  is equal to any of the data in the rows for that column.
    I found a function on another forum that should help me achieve this but I still cannot get it to work as I don't think I'm using the function correctly. Note the function is called "findItem()"
    Here is my example code:
    //I have a datagrid
    <mx:DataGrid id="myDataGrid"  dataProvider="amfcall.getData.lastResult}">
             <mx:columns>
                <mx:DataGridColumn  headerText="MyHeading" dataField="myDataField"/>
             </mx:columns>
    </mx:DataGrid>
    //I  have a form for adding data into the datagrid
    <mx:Form  id="addData">
        <mx:FormItem>
            <mx:TextInput  id="myText"/>
        </mx:FormItem>
    </mx:Form>
    //I  have a button to submit the form data by calling a function
    <mx:Button  label="Add" id="addData" click="findItem()"/>
    //I  have the function to find any item in the datagrid column that is equal  to the text input in the form. This is what I can't code correctly.
    public  function findItem(myDataGrid.dataProvider, myDataField:String,  myText.text):Boolean
         for each(var item:Object in  myDataGrid.dataProvider)    
              if(item[myDataField] == myText.text)            
                return  true;    
         return false;
    So I don't think I'm correctly typing the first line of the 'findItem' function as I'm currently receiving [I]1084: Syntax error: expecting rightparen before dot.[/I] for this line [I]public function findItem(myDataGrid.dataProvider, myDataField:String, myText.text):Boolean [/I]
    Also, the error does not change if I strict type those things to ':Object' etc.
    I may just be using the function totally wrong, can anyone hlpe me out?

    Hard to tell what’s going on from the information you are providing; but just looking at the first line of your sample code:
    Have you checked in the debugger to see what your dataProvider looks like?
    You want a resultHandler to set some kind of list – let’s say a previously declared AC, which then becomes your dataProvider for the DataGrid. Something like:
    private function amfCallResultHandler(event:ResultEvent):void{
          Var someVar:ArrayCollection = event.result as ArrayCollection;
          blah blah blah;
          myDataProvider = someVar;    
    HTH,
    Carlos

  • How to add round image inside the table column? with different background color, column value should appear in the middle of the round portion.

    Hi
    This question is related to table component implementation.
    I want to display the column values inside the small round image with different colors and value should appear in the middle.

    Hi,
    >>1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
    2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
    3.how to make my column headers in bold?<<
    I’m sorry for the issue that you are hitting now.
    This itextsharp is third party control, for this issue, I recommended to consult the control provider directly, I think they can give more precise troubleshooting.
    http://sourceforge.net/projects/itextsharp/
    Thanks for your understanding.
    Regards,
    Marvin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to add a default value in a site column for every item in a document library

    HI
    i created a content type with some site columns ,
    and included in a Document library.
    Process ( content type)
    -ProcessNo
    -ProcessName
    after that i uploaded 100 Documents but not  added value in a site column process name.
    now  how i add a default value in a site column for every document in a document library 
    adil

    HI
    i get below error when i change the script 
    PS C:\scripts> C:\Scripts\updatedefaultvalue.ps1
    Cannot index into a null array.
    At C:\Scripts\updatedefaultvalue.ps1:8 char:7
    + IF($i[ <<<< "Title"] -eq $null)
        + CategoryInfo          : InvalidOperation: (Title:String) [], RuntimeExce
       ption
        + FullyQualifiedErrorId : NullArray
    $web = Get-SPWeb http://tspmcwfe:89/
    $list = $web.Lists["test"]
    $item = $list.Items | Where { $_["Name"] -eq "Emc" }
    foreach($i in $items)
    IF($i["Title"] -eq $null)
             $i["Title"] = "test"
           $i.Update()
    adil
    Why are you piping a where in the items? Do you only want to add the "test" to ones matching
    a name?
    If you have ISE installed on your server I recommend you put your code in there and debug it. 
    If this is helpful please mark it so. Also if this solved your problem mark as answer.

  • How to add spaces to the column value to make it up specifi length string please

    Hello There,
    Could you please guide me here to solve this issue,
    in my column (named as State) contains values as below
    California
    Washington
    Utah
    Connecticut
    Massachusets
    in the output how can i add a spaces to make up every column values as 15 length (for ex, Utah is 4 length then need to add 11 spaces, California is 10 would like to add 5 spaces)
    i tried below but no use in Sql 2008 R2
    SELECT  distinct state
       state
    +SPACE(35-len(state)),
    len(state+SPACE(35-len(state)))
    FROM dbo.ordersInfo
    Thank you in advance
    Milan

    Fixed length CHAR(n) data in SQL is automatically padded with spaces. Either change the column's data type or cast to it. Also, the ISO-11179 rules are that the column should be "state_name" and not just the root attribute "state" -- state_code, state_population,
    etc are a few of the confusions you created. 
    Another rule of RDBMS is that we do not do display formatting in the data. That is what presentation layers do. Why are you trying to fake COBOL in SQL? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to add only highest values in the column

    Hello All,
    We have report where I need to add only highest values in 'Price' column.
    Ex:
    Group  Mat      Price
    Grp1    Mat1    50
               Mat2    75
               Mat3    100
    Grp2    Mat1    50
               Mat2    100
    I need my result as 200...
    Any input is appreciated!
    Thanks in advance !!
    Venu.

    Sriman/Surendra,
    Unfortunately, this approach does not work because the Calculate Result As --> Maximum applies not only to the subtotals but also to the grand total. Therefore, the result in Venu's example will be:
    MAX(Grp1) = 100
    MAX(Grp2) = 100
    MAX(All Grps) = 100
    We have the same requirement as Venu, but have not found a satisfactory solution yet. The only way we have solved such problems in the past is to use VBA in workbooks, but the report we are using now is a Web report.
    Hope this helps to clarify the issue...
    Bob

  • Add sort, filter, export to excel and summation of tab column values in VC

    Hi,
    Can anyone help me out in providing the following functionalities in the Visual Composer tableUI element :
    1. Sort
    2. Filter
    3. Export to Excel
    4. Summation of Table Column Values
    5. Update entry in table
    6. Create entry in table
    Thanks in advance.
    Wish you great time.
    Best Regards
    Sid

    Hello Sid,
    1. Sort
    --> This is a standard functionally of tables in VC
    2. Filter
    --> Use the filter element of VC
    3. Export to Excel
    Go to: Sdn>Wiki>VC>Modeling>Export data to Excel/PDF
    4. Summation of Table Column Values
    --> This depends on your data source. If you use BI queries you have this normally automatically. If not you can use the sum element of VC.
    5. Update entry in table
    6. Create entry in table
    > see Sdn>Wiki>VC>Modeling-->Moving data between tables
    Kind regards
    Thomas

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

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

  • Different flex components based on AdvancedDataGrid column value

    I have the following code snippet, here I am able to change the label of the button based on the Data Grid's Column value. I am unable to think of a way where I can add two completely different buttons, based on Data Grid's value. Any help will be greatly appreciated.
    _SM
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" >
    <mx:Script>
    <![CDATA[
    import mx.managers.PopUpManager;
    import mx.collections.ArrayCollection;
    import flash.utils.Dictionary;
    import mx.core.Application;
    import mx.controls.Alert;
    import mx.events.ItemClickEvent;
    [Bindable]
         public var seatingChart:ArrayCollection = new ArrayCollection();
         public function init():void {
    var airCraftSeating:Object = new Object();
    airCraftSeating["fname"] = "foo";
    airCraftSeating["lname"] = "bar";
    airCraftSeating["iflag"] = true;
    seatingChart.addItem(airCraftSeating);
    airCraftSeating = new Object();
    airCraftSeating["fname"] = "dude";
    airCraftSeating["lname"] = "buddy";
    airCraftSeating["iflag"] = false;
    seatingChart.addItem(airCraftSeating);
    airCraftSeating = new Object();
    airCraftSeating["fname"] = "playstation";
    airCraftSeating["lname"] = "three";
    airCraftSeating["iflag"] = true;
    seatingChart.addItem(airCraftSeating);
    airCraftSeating = new Object();
    airCraftSeating["fname"] = "dudeeye";
    airCraftSeating["lname"] = "buooosldk";
    airCraftSeating["iflag"] = false;
    seatingChart.addItem(airCraftSeating);
    ]]>
    </mx:Script>
    <mx:Canvas id="baseColor" height="100%" width="100%">
    <mx:Form left="5" right="8" width="100%" height="100%" borderThickness="2" id="classForm" >
        <mx:DataGrid  id="dgClassTypes" dataProvider="{seatingChart}" sortableColumns="false" wordWrap="true" variableRowHeight="true" horizontalGridLines="false" verticalGridLines="false" width="100%" height="100%" verticalAlign="top" >
        <mx:columns>
    <mx:DataGridColumn dataField="fname" headerText="fname"  textAlign="left" visible="true"/>
    <mx:DataGridColumn dataField="lname" textAlign="center" visible="false"/>
    <mx:DataGridColumn textAlign="center">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Button  label="{data.iflag?'check':'delete'}" visible="true" />
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    <mx:DataGridColumn dataField="lname" textAlign="center" visible="false"/>
        </mx:columns>        
    </mx:DataGrid>
    </mx:Form>
    </mx:Canvas>
    </mx:Application>

    Put the buttons in the VBox inside the itemrenderer and set the visible property bindable to iflag value.
    <mx:DataGridColumn textAlign="center">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Canvas>
        <mx:Button  label="check" visible="{data.iflag}" height="{data.iflag? 20:0}"/>       
        <mx:Button  label="delete" visible="{!(data.iflag)}" height="{data.iflag? 0:20}"/>   
    </mx:Canvas>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    Thanks and Best regards,
    Pooja Kuber | [email protected] | http://www.infocepts.comwww.infocepts.com

  • Show dataTip on a datagrid column

    Hi,
    I need to show dataTip on a datagrid column only if its length is greater than 20 chars.
    Additionaly, my datagrid is a custom component, I am passing the column names as an array and building the grid dynamically
    so that it could be used for any dataprovider (with different set of columns).
    when the dataTipFunction is invoked runtime I would not know the column field name
    to access the value since the dataTipFunction makes available only the item:Object unlike labelFunction which provides both item and column.
    But i would know all the column names at any given point in time.
    Is there anyway we can get hold for which column the dataTipFunction is being called for...
    Any help is greatly appreciated.

    Subclass DataGridColumn and add the dataTipFunction to the subclass.  Then
    the 'this' pointer will be the column.

Maybe you are looking for

  • "Reading Untagged Document" but... I don't have a screen reader

    A few weeks back, I started getting this dialog every time I open a PDF. "Reading Untagged Document", asking me to set the Reading Order Options.I have no idea what triggered it, but it seems to be something to do with setting up the files for visual

  • How to skip first 5 lines from a txt file when using sql*loader

    Hi, I have a txt file that contains header info tat i dont need. how can i skip those line when importing the file to my database? Cheers

  • Photo Stream in my iPad2 doesn't work. Help me

    Since I have updated my iPad 2 to 5.1.1 version, the photo stream worked well but today it doesn't. I capture one photo in my ipad but that photo isn't uploaded to photo stream so i can't get it in another devices. Can anyone help me to solve this pr

  • How to not store messages on the server...

    I almost never used my mac webmail. And I justr ealized I've got like 20,000 messages and all of my space is used up. The thing is I've got a copy of all of these on my machine. So how do I get mail to just move the stuff to my machine and delete off

  • Lumetri SLog3 Noise Issue -- please help!

    I've been shooting a lot of Slog 3 footage with our Sony FS7. I edit the footage in the latest version of adobe premiere the following way: I place the 4k footage on a timeline and tell it to match the clips settings (3840x2160 XAVC-I 24p is what I s