Sorting Columns in Datagrid

Developing in Flash, AS3.
I have a datagrid that uses a custom cellrenderer class to allow me to use a combobox. I have an invisible column that holds the value returned by the cellrenderer when the combobox value is changed. BUT sorting is wonky. Since what really lives in the combobox column individual cells is an object, it never really sorts properly. Is there a way to fire a sorting event to the column that holds the real value?
Thanks in advance!

Thank you very much for your quick reply. Would you mind providing an example that will work with a combobox?
Right now, I'm using this bit of code, just to track which cel is being interacted with:
          public function gridItemSelected(e:ListEvent):void {
               trace ("***");
               trace( "Row Index: " + e.rowIndex);
               trace( "Column Index: " + e.columnIndex);
               var colName:String  =  e.target.columns[e.columnIndex].dataField;
               trace( "Column Field Name: " +colName);
               trace( "Cell data: " +e.item[colName]);
               trace("***");
which traces out something like this:
Row Index: 0
Column Index: 0
Column Field Name: cname
Cell data: [object Object],[object Object],[object Object],[object Object],[object Object]

Similar Messages

  • Sort Column Date - DataGrid - Flex 4.5.1

    Hi
    I made download the function (below)  to sort column date in DateGrid, but is not working
    private function date_sortCompareFunc(itemA:
    Object, itemB:Object):int
       var dateA:Date=new Date(Date.parse(itemA.dob));
        var dateB:Date=new Date(Date.parse(itemB.dob));
       return ObjectUtil.dateCompare(dateA, dateB);
    <s:GridColumn dataField="DATA_VENCIMENTO_ID"
        width="115"
        headerText="Data Vencimento"
         dataTipFunction="date_sortCompareFunc">
    someone can help me?
    Marcos

    Hi Marcos,
    This forum here is for questions related to the LiveCycle Collaboration Service product.
    You might want to post your question to the Flex forum:
    http://forums.adobe.com/community/flex/flex_general_discussion
    Hope this helps.
    Good luck,
    Julien
    LCCS Quality Engineering

  • Sort column in advanceddatagrid

    Hi, i have an interesting question - how to sort column id
    datagrid, like i clicked on a header. I use AdvancedDataGrid and
    HierarchialData

    Yes, it works for HierarchicalCollectionView, but works for
    only first level of the tree. Like I sort an XMLListCollection,
    comparefunction handles only full elements of the first level. I
    need also to sort children nodes of the thee (customer wants).
    I have done it for XMLListCollection which is the source of
    HierarchialData but it's too many letters =)) and i need sort it
    and refresh HierarchialData after every change. Advanced datagrid
    makes it automatically by pressing on a header.
    Here is the code:
    quote:
    public static function
    sortXMLListCollection(xml:XMLListCollection,dataField:String):XMLListCollection
    var sorting:Sort=new Sort();
    sorting.fields=[new SortField(dataField)];
    xml.sort=sorting;
    xml.refresh();
    for each(var item:XML in xml)
    XMLUtils.sortXMLNode(item,sorting);
    return xml;
    public static function
    sortXMLNode(node:XML,sorting:Sort):XML
    var tempXML:XMLListCollection=new XMLListCollection(node.*);
    tempXML.sort=sorting;
    tempXML.refresh();
    XMLUtils.clearNode(node);
    XMLUtils.appendXMLListInXML(node,tempXML.copy());
    for each(var item:XML in node.*)
    XMLUtils.sortXMLNode(item,sorting);
    return node;
    public static function
    appendXMLListInXML(xml:XML,xmlList:XMLList):XML
    for each(var appendXML:XML in xmlList)
    xml.appendChild(appendXML)
    return xml;
    public static function clearNode(xml:XML):XML
    for(var i:int=new
    XMLListCollection(xml.*).length-1;i>=0;i--)
    delete xml.*
    return xml;

  • Sorting columns in a flex datagrid

    The datagrid gets its data from a back end database which has records like
         RecordID           Division     Department      Date_Report_Submitted
        1.                 Finance      Accounting        11/1/2010
        2.                 Engineering  Design            4/2/2011
        3.                 Engineering  Implementation    4/2/2011
        4.                 Support      Chat_Support      2/4/2010
    Clicking on the headers in the Datagrid column(Department) results in a sort based on recordID like
                Division     Department      Date_Report_Submitted
                Finance      Accounting        11/1/2010
                Engineering  Design            4/2/2011
                Engineering  Implementation    4/2/2011
                Support      Chat_Support      2/4/2010
    whereas I want it to be sorted alphabetically for the Datagrid column(Department) like
                Division     Department      Date_Report_Submitted
                Finance      Accounting        11/1/2010
                Support      Chat_Support      2/4/2010
                Engineering  Design            4/2/2011
                Engineering  Implementation    4/2/2011
    since Accounting should come before Chat_Support as per lexicographical order.
    Looked at http://blog.flexexamples.com/2008/04/09/creating-a-custom-sort-on-a-datagrid-control-in-fl ex/#more-590 and have something like
             <mx:DataGrid id="myRecords"  dataProvider="{myRecords_dp}" width="810" height="274"                        
        itemClick="getRecordData(event)">
            <mx:columns>
                <mx:DataGridColumn id="firstCol" width="180" fontFamily="Arial" fontSize="12"
                                   wordWrap="true" />
                <mx:Button label="Click to Sort" click="mysort()" />
            </mx:columns>
        </mx:DataGrid>
    and
                private function mysort():void
                   var sortField:SortField = new SortField();
                   sortField.compareFunction = mycompare;
                   sortField.descending = false;
                   var sort:Sort = new Sort();
                   sort.fields = [sortField];
                   myRecords.sort = sort;
                   myRecords.refresh();
                            private function mycompare(lhs:Object, rhs:Object):int
                    var valueA:String = lhs.text();
                    var valueB:String = rhs.text();
                    return ObjectUtil.stringCompare(valueA, valueB);
    I get errors like
    1061: Call to a possibly undefined method refresh through a reference with static type mx.controls:DataGrid.   
    for myRecords.refresh();
    and
    Access of possibly undefined property sort through a reference with static type mx.controls:DataGrid.   
    for myRecords.sort
    Any suggestions would be appreciated.

    I should have clarified this from the start itself. The backend database has few tables. One is Divisions which has some fields like
    Division ID Division Name. Another is Department which has fields like RecID, Division ID, Department Name. What is being retrieved from the dataprovider(myRecords_dp) is Rec ID, then a labelfunction converts the Rec ID into Department name by looping over the department table and displays it. So, if Implementation has a recID of 3 and Chat_Support of 4, Implementation will come before Chat_support when I click on the header so it will not be in lexicographical order.

  • Keep sorting and sort arrows after datagrid dbprovider changed

    I followed this tutorial http://justinjmoses.wordpress.com/2008/06/26/flex-keeping-the-sort-on-a-datagrid-when-you- change-the-dataprovider/
    created listeners
    that keeps old sorting of datagrid after dataprovider changed, but displaying sort arrow on the wrong column(always the 1st column), how do I fix it?
                       //constructor
              public function FilterDatagrid()
                   super();
                   addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE, onDataGridDataChange, false, 0, true);
              private var currentSort:mx.collections.Sort;
              private function onDataGridDataChange(evt:CollectionEvent):void
                   //get the new data collection
                   var ac:ArrayCollection = this.dataProvider as ArrayCollection;
                   //attach the collection change event
                   ac.addEventListener(CollectionEvent.COLLECTION_CHANGE, onCollectionChanged,false,0,true);
                   //if a sort was in place before the data was changed, make sure you apply the sort to this new data
                   if (currentSort != null)
                        ac.sort = currentSort;
                        ac.refresh();
              private function onCollectionChanged(evt:CollectionEvent):void
                   if (evt.kind == CollectionEventKind.REFRESH)
                        var ac:ArrayCollection = evt.currentTarget as ArrayCollection;
                        currentSort = ac.sort;

    the datagrid uses XML as dataprovider and uses labelFunction and sortCompareFunction on each column, not sure if it matters

  • Sort columns in matrix report

    Hi all
    I create matrix report( in version 9i)
    I want sort columns of report
    when i use order by it sort rows but i want sort columns
    my query is like this:
    SELECT
    Code,
    name,
    DECODE(cons_code, '1', 'A',
    '2', 'B',
    '3','C',
    '4', 'D',
    '5', 'E') Activity,
    SUM(amnt) amount
    From Mytable
    Where ....
    group by
    Code,
    DECODE(cons_code, '1', 'A',
    '2', 'B',
    '3','C',
    '4', 'D',
    '5', 'E')
    my group base on code
    my columns base on Activity
    and cells are Amount
    my report result is:
    ........ B E D A C
    name1 1 1 1 1 2
    name2 3 4 8 6 1
    I want this :
    ........ A B C D E
    name1 1 1 1 1 2
    name2 3 4 8 6 1
    ....

    Hello,
    How about this?
    SELECT Code, name,
    DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D','5', 'E') Activity, SUM(amnt) amount
    From Mytable
    WHERE ....
    GROUP BY Code, name, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E')
    ORDER BY code, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E')

  • How to validate a whole column of DataGrid

    I want to validate a whole column of DataGrid using
    Validator.
    How to do that?

    Thanks. It works! Prima!
    It's a little bit difficult for me to write and understand the English terms correctly, cause I am German.
    I did not recognize, that I had to go to the Library Module!
    Here I repeat Rikk's way in German:
    Im Bibliothek-Modul
    Rasteransicht
    Bilder selektieren
    Im Menufeld Ad-hoc Entwicklung:
    Freistellungsfaktor einstellen: 16:9

  • A simple question about wrong sorting with multiple sort columns in Excel 2010

    Hi, everyone! I have encountered a problem that I don't know how to explain.
    So I post it here because I don't know if there is another more relevant forum...
    I have a data sheet with the students' scores for the course. 
    All the data were generated with the randbetween function,
    and pasted with the values.
    To rank the students by their performance,
    I did the sort with the column "total score" as the first sort-column
    and "final term" as the second.
    The weird thing to me is that the order of the data seems problematic.
    That is, all the rows are sorted correctly with the first sort-column.
    But for the rows with the same values of the first sort-column,
    there are some rows whose values of the second sort-column are out of order.
    (please look at the data file at
    www_dot_kuaipan_dot_cn/file/id_67204268108546068_dot_htm
    Please change the "_dot_" to the real literal dot.
    Especially the rows with 56.7 as the first sort-column value
    and some other values near the tail of the list.)
    I tried to manually input and sort the same values of both columns
    in a near-by region. The result was correct.
    When some friend copied all the data to paste in Notepad,
    and reload them in excel. The problem disappears.
    Some friend also tried to wrap a round function at the values of the 1st sort-column,
    the sorting order became correct!
    But they could not explain why either.
    How confusing! I even tried to swap the first and secod sort-column;
    the output was right.
    All the data were generated by randbetween function and pasted with values.
    Where could all the special characters, if any, come?
    Can anyone give me an explanation? I would be very grateful.
    Thanks in advance!

    Re:  Sort is not in proper order
    Sounds as if the data includes spaces or hidden characters that are affecting the sort.
    That is indicated by the fact that manually entering the data resolves the problem.
    Note:  You can use a public file storage website to hold your file and add the link to it in your post.
    Jim Cone
    Portland, Oregon USA
    Special Sort excel add-in (30+ ways to sort) - 3 week no obligation trial
    https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2

  • How can I get (using API) the current sort column for some report

    hello,
    How can I get (using API) the current sort column for some report ? For example something like "fsp_sort_1_desc" - if the user sorts by the first column ?
    I cannot use the :REQUEST for this, sometimes the current sort column is not in the :REQUEST, but it is still active.
    I thought it was posssible by using
    APEX_UTIL.GET_PREFERENCE (
    p_preference IN VARCHAR2 DEFAULT NULL,
    p_user IN VARCHAR2 DEFAULT V('USER'))
    RETURN VARCHAR2;
    function, but I don't really know which preference should I pass as parameter.
    looking in WWV_FLOW_PREFERENCES$, i saw preferences_names like FSP4000_P527_R6281510839654570_SORT , I'm not sure how this name is formed.
    I'm using generic columns for that complex report (which has a flexible number of columns shown), and the idea is that sometimes I have to overwrite that sort column, in case the user chose the version of the report with fewer columns than the previous one.
    Can I get (using API) a list of all preferences set for some user ?
    Thank you,

    seems that it is FSP<app_number>P<pagenumber>R<regionnumber>_SORT.
    is there anyplace where I can get these kind of things documented ?
    Thank you.

  • Problem  in  specifing the intial sorting column of  a report

    hi
    we have a report based on a table with 6 columns in our home page .we display all the six columns as sortable.
    we also need to sort the contents of the report by 4th column by default when ever the user logs in ,but what happens is ,report gets sorted automatically depening upon the previous sorting column selected
    is there any way of telling htmldb to sort the report by 4th column ..
    many thanks
    S.Jawahar

    hi ,
    this infotype has a interesting solution . In my case it was  for US country .
    We select the veteran status and this is field P0077-VETST  which is stored in DB table .
    Now based on this value and the molga of that pernr  we need to look at the T5UVT table for the combinations avaliable for MOLGA AND  VETST .
    Based on the config's of this table the screen values are getting populated .
    It dosent allow any combinations and the picked values are passed to the screen for fields Q0077-VETS1 VETS2 VETS3 VETS4 .
    Br,
    Vijay.

  • How do you sort columns?

    i dont think i saw sorting columns in the doc. anyone can point me? thanks

    You’ll find information about how to enable column sorting in the HTML DB user guide:
    http://download-west.oracle.com/docs/cd/B13789_01/appdev.101/b10992/mvl_design.htm#sthref1122
    Regards,
    Marc

  • Sorter column in dashboard

    Hi all,
    I use obiee 11g and I want enable sorting column in my dashboard but some report are sorted and other aren't sorted.
    Can you help me?
    Why this situation?
    Exists some setting in the dashboard?
    Thanks and regard

    Hi AmolPalkar,
    I use the last version of OBIEE (11.7).
    I can not render the sorting on columns in the dashboard.
    Can you help me?
    Thanks
    Nadia

  • How to fix the width of sorting column about adf table ?

    I develop project with ADF in jdeveloper.
    When click on the sorting column header in adf table,it will adjust the width of the sorting column header.It will make page shifting.
    How can I do to avoid the adjusting ?
    How can I do to fix the width of soting table header?
    Any hint will be appreciated.
    Thank you!
    Message was edited by:
    user618145

    I have set the column width like this:
    in style.css:
    /** Column Settings **/
    af|column::header-text
    background-color:#F0EDE1;
    color:#000000;
    font-family:Arial,Helvetica,sans-serif;
    font-size:12px;
    font-weight:bold;
    padding-left: 2px;
    padding-right: 2px;
    padding-top: 3px;
    padding-bottom:3px;
    border-color: #B5B5B5;
    WIDTH: 120px;
    af|column::sortable-header-text
    background-color:#F0EDE1;
    color:#000000;
    font-family:Arial,Helvetica,sans-serif;
    font-size:12px;
    font-weight:bold;
    padding-left: 2px;
    padding-right: 2px;
    padding-top: 3px;
    padding-bottom:3px;
    border-color: #B5B5B5;
    WIDTH: 120px;
    and in jsp page,write like this:
    <af:panelBox text="test" width="1000" background="dark" >
    <af:table emptyText="" value="#{ftOverview.listOfTransefersVect}" var="transfers" width="100%" banding="row" bandingInterval="1">
    <af:column sortable="true" sortProperty="transactionId" headerText="#{resources['ft_overview.ref']}" formatType="text" width="39"
    noWrap="true">
    <af:outputText value="#{transfers.transactionId}" escape="false"/>
    </af:column>
    </af:table>
    </af:panelBox>
    but it seems doesn't work well.

  • Locking and sorting columns

    This is what I am trying to do:
    Lock the information in column A so it always stays there (1st, 2nd , 3rd, etc.)
    Sort Column C (total winnings) in descending order and keep the coresponding participants (column B ) with the amount.
    Create a value in Column D (4 behind Leader) that shows the difference between C3 and C4, C3 and c5, etc.
    The amounts and names are  filled from another sheet and change weekly. I can sort based on total winnings and the names follow. I can also create a formula to show the difference between the Leader and the next place participant however when I do a sort based on Total Winnings after the new values each week the Place and $Behind Leader always shift up and down. The information in Column A seems "locked" to the information in Columns B and C. The refernce in Column D is always Chris's amount and I want it to be refenced to the 1st place Participant.
    I hope I've explained this.
    Thanks - James
    2013 Standings
    Place
    Participant
    Total Winnings
    $ Behind Leader
    1st
    Chris
    $24.00
    2nd
    Ken
    $22.00
    -$2.00
    3rd
    Paul
    $20.00
    -$4.00
    4th
    Josh
    $18.00
    5th
    Kelly
    $16.00
    6th
    Greg
    $14.00
    7th
    Dave
    $12.00
    8th
    Darren
    $10.00
    9th
    Don
    $8.00
    10th
    Tony
    $6.00
    11th
    Suzanne
    $4.00
    12th
    James
    $2.00
    13th
    Spare 1
    $0.00
    14th
    Spare 2
    $0.00
    15th
    Spare 3
    $0.00
    16th
    Spare 4
    $0.00
    17th
    Spare 5
    $0.00
    18th
    Spare 6
    $0.00
    19th
    Spare 7
    $0.00
    20th
    Spare 8
    $0.00

    Hi j&s,
    Numbers uses a data base model that treats each row of a table as a single record. You can sort all or selected rows on the values in one or more column(s), but the whole row moves to maintain the integrity of each record.
    If you want some columns to be excluded from a sort, you need to remove those columns (or their data) from the table. Jerry has offered a way to do that for the rankings, but that solution will not resolve the issue of the 'leader board' cells acting badly in a sort.
    Here's an alternate. The first view is of the table(s) (with the participants in alphabetical order), just after the current totals had been entered.
    At this point, the Leader board, which pulls names and totals from the first three body rows of the data table, shows the correct cells, but these don't include the correct information.
    Note that column A does show the correct placing for each participant.
    The second view shows the same table(s) after the data table has bee sorted. The sort may be descending on column C (Totals) or ascending on column A (Place).
    Place is calculated from the Total values, using this formula:
    A2: =RANK(C2,C,largest-is-high)
    Fill down into the rest of the cells in column A. Any empty rows should be removed from the bottom of the table, or have zeros entered into their total column cells.
    The Leader board table has two formulas:
    A2: =OFFSET(Data :: $A$1,ROW()-1,1)
    Fill down to A4.
    This returns the name of the participant in the top body cell of column B of the data table.
    B2 contains the word "Leader"
    B3: =IF((OFFSET(Data :: $A$1,1,2)-OFFSET(Data :: $A$1,ROW()-1,2))>0,OFFSET(Data :: $A$1,1,2)-OFFSET(Data :: $A$1,ROW()-1,2),"Leader")
    Fill down to B4
    The root of this formula is OFFSET(Data :: $A$1,1,2)-OFFSET(Data :: $A$1,ROW()-1,2)
    This returns the total value from the first and second body cells in the total column, and subtracts the second from the first.
    The rest of the formula is an IF statement tohandle the occasions where there's a two or three-way tie for the lead. (image below) If the result is greater than zero, the subtraction is repeated and the result returned to the cell (B3); if the result is zero, the word :Leader: is returned to this cell.
    Placing the calculation in a separate table and using OFFSET, with a base cell (Data::A1) that is in a row defined as a Header row makes this table and its formulas immune from sorting of the Data table.
    Here's the tie, which arose when i added another 11 particpants to check sorting of the Place column:
    Regards,
    Barry
    Message was edited by: Barry (added image and notes on Tie case)

  • Sorting within sorted columns?

    Is it possible to sort columns by say artist & say track names all at one time? If so how is this done?
    Thanks in advance

    Yes, it is.
    Use the Songs view, and turn on the Column Browser. Then select the artist you're interested in and finally click on the Name column so the arrow points upwards - as shown below:
    <picture>
    While the artist is highlighted, the additional (greyed out) selection of "All Genres" and "All Albums" ensures that every song by The Beach Boys is shown, even if they are from different genres.
    This doesn't work for artists who only appear on compilation albums though. There is a way to see them, but it's a bit more involved.
    To do this, use the Songs view, and turn on the Column Browser. (Oddly, the shortcut for the Column Browser - CTRL+SHIFT+B - isnt working in iTunes 11.1.3.8, so click on the View/Column Browser/Show Column Broswer if you have the same problem. CTRL+B will turn on the menu bar at the top (with View on it).

Maybe you are looking for

  • How to access the Web Service Browser

    Hi, I need to access the Web Service Browser to generate a Web Service Description. How can I do it? I use the follow url: http://<host_name>:<port_number>/sap/bc/bsp/sap/WebServiceBrowser/search.html?sap-client=<relevant_client> but I can't say how

  • Reg : Passing multiple rows of table data to the RFC

    Hi, I am passing one row of data from webdynpro table to table of RFC. How to pass multiple rows of data. Please help me out. Thanks Risha

  • File associations / sandboxed app.

    http://www.1point1c.org/spacesim/spacesim.jnlp Points to the launch file for a sandboxed application (<150 Kb download) that claims (OK suggests) file associations for two file types '.sss' (space simulation scenarios) & '.sso' (space simulation opti

  • Very slow laptop - Pavilion g6-2245ea

    Hi, My Pavilion g6-2245ea laptop has started to run extremely slowly, even during the most simple of tasks. I was hoping to get some advice on an upgrade.  It has a 1.7ghz  processor with 8gb of RAM and is running windows 8. Which of these should be

  • Just upgrade to 10.8 and now cant print to windows Share

    Hi, I just took the plunge and upgraded to 10.8  My old system was 10.6.  The problem is the college I work for has a mandate on printing that all print jobs must print through the windows print server.  The printer vlan is not accessible to the gene