Hierarchical  AdvancedDataGrid : selecting a specific index

I'm trying to select some items displayed in a hierarchical
AdvancedDataGrid. The underlying items in the dataProvider have
been replaced but using their id I want to select them back in the
AdvancedDataGrid.
1) The dataGrid is displayed and item id #123 is selected
2) The datatGrid's dataprovider is replaced
3) I want to select item #123 back in the dataGrid
To do this, I loop over the new dataProvider and I compare
the ID (#123) to find the new instance of the item that should be
selected. Then I do:
myDataGrid.selectedItem = newItem;
But it doesn't seem to work for a reason I don't understand.
I did a lot of tests using all the 'validate()', 'invalidate()' and
'refresh()' methods I could find but nothing worked.
But, if I use the index instead :
var newIndexToSelect:int =
newDataProvider.getItemIndex(newItem);
myDataGrid.selectedIndex = newIndexToSelect;
It does work! But only if the dataProvider is an
ArrayCollection! It doesn't work if it's a
HierarchicalCollectionView. And I need to use GroupingCollection to
create my dataProvider because I use the tree feature of the
AdvancedDataGrid.
When the dataProvider is a HierarchicalCollectionView, I have
no idea how to select the correct index in the Grid! Some of the
row in my tree-grid are not actual items but 'groups' so I can't
map the indices of my actual items in the Collection's source to
the indices in the datagrid!
Any help or tips on how to select a particular index in a
hierarchical AdvancedDataGrid ?
Thanks a lot!
JL

quote:
Originally posted by:
Sreenivas R
The index based selection for hierarchical ADG is tricky
because the index of an item can keep changing depending on the
open/closed nodes before it.
Exactly.
Here's a code example, where I populate the grid with some
items and later try to select item with ID "c" using its index
("test()" method is the entry point):

Similar Messages

  • How to select a specific cell in a JTable?

    Hi there,
    in a JTable, I would like to select a specific cell (to highlight it) from a JButton.
    Here a sample code...
    Who could help me to fill it?
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TableSelection{
        public static void main (String args[]) {
          JFrame frame = new MyFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.show();
    class MyFrame extends JFrame{
      public MyFrame(){
        setTitle("TableSelection");
        setSize(WIDTH,HEIGHT);
        DefaultTableModel myModel = new DefaultTableModel(2,2);
        JTable myTable = new JTable(myModel);
        myTable.setCellSelectionEnabled(true);
        JButton button00 = new JButton("select 0,0");
        button00.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent event){
         System.out.println("selection of cell (0,0)");
         //--- what code is required to select the cell(0,0)?
        JButton button11 = new JButton("select 1,1");
        button11.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent event){
         System.out.println("selection of cell (1,1)");
         //--- what code is required to select the cell(1,1)?
        Box myBox = new Box(BoxLayout.Y_AXIS);
        myBox.add(new JScrollPane(myTable));
        myBox.add(button00);
        myBox.add(button11);
        getContentPane().add(myBox, BorderLayout.CENTER);
      private static final int WIDTH=200;
      private static final int HEIGHT=200;
    }Thanks a lot for your help.
    Denis

    Use the addColumnSelectionInterval(int index1, int index2)method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addColumnSelectionInterval(int,%20int)
    and the addRowSelectionInterval(int index1, int index2) method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addRowSelectionInterval(int,%20int)
    Hope that helped.
    afotoglidis

  • How to select a specific column in a bean method?

    Hey everyone,
    I'm trying to select a specific column in my adf table so i can hightlight the ones i can after, with a method bean that does a match from another table. I'm using JDeveloper 12.1.2.0.0.
    Here's my table at the moment (its a static list that Timo and Alejandro helped me create, thanks to them again!):
    <af:table value="#{bindings.Anos1.collectionModel}" var="row"
                                                              rows="#{bindings.Anos1.rangeSize}"
                                                              emptyText="#{bindings.Anos1.viewable ? 'No data to display.' : 'Access Denied.'}"
                                                              rowBandingInterval="0" fetchSize="#{bindings.Anos1.rangeSize}"
                                                              filterModel="#{bindings.Anos1Query.queryDescriptor}"
                                                              queryListener="#{bindings.Anos1Query.processQuery}"
                                                              filterVisible="false" varStatus="vs" id="t5"
                                                              styleClass="AFStretchWidth" columnSelection="multiple"
                                                              inlineStyle="max-width:100%;" columnStretching="multiple"
                                                              columnSelectionListener="#{ControlBean.onAnoColumnSelect}"
                                                              disableColumnReordering="true"
                                                              binding="#{ControlBean.dimAnos}">
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2011.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2011"
                                                                   id="c54" width="16%">
                                                            <af:outputText value="#{row.A2011}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2011.tooltip}"
                                                                           id="ot54">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2011.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2012.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2012"
                                                                   id="c55" width="16%">
                                                            <af:outputText value="#{row.A2012}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2012.tooltip}"
                                                                           id="ot55">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2012.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2013.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2013"
                                                                   id="c56" width="16%">
                                                            <af:outputText value="#{row.A2013}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2013.tooltip}"
                                                                           id="ot56">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2013.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                    </af:table>
    I've deleted some of the columns because they are all equal and by doing so, you have less problems in reading it.
    In my method i have a matchEm but i'm trying to select a column by using this line:
            dimAnos.setColumnSelection("A2012");
    dimAnos is the binding for my table Anos (Years in Portuguese). I even tried another values fro the columnSelection but i couldn't make it selected. Am i doing anything wrong?
    Please help me or give me an idea of how can i do this.
    Regards,
    Frederico.

    Hi Frederico,
    The method setColumnSelection is meant to set whether your table supports column selection or not. It doesn't select the column. In order to select the column, you need to set the column attribute Selected to true. So I don't know if its an option for you but you can create a binding to all the columns you have in you bean, and then call the method A2012.setSelected(true), and then add a partial target to the table to re render it and show the selected column.
    Hope this helps

  • Can you select a specific item from a listbox via scripting?

    This seems like it should be easy, but I've spent quite a few hours trying to figure this out, to no avail.  I'm trying to create a button that would automatically select a specific item on a listbox.  I though "selectedIndex" would do the trick, but this seems to only work if the user actually selects a specific item on a listbox.  I'm looking for the opposite effect, where a person will push a button where a specific item on the listbox gets selected.
    Any help would be much appreciated...thanks!

    You can use the setItemState method for this purpose.
    To select the third item use:
    ListBox.setItemState(2, 1);

  • How to: Select a Specific Timeline Displayed in Project Online when having multiple timelines within the Enterprise Project

    Currently I have an Enterprise Project which has 6 custom timelines and I want to know how to select a specific timeline to be displayed on the Project specific SharePoint site.
    I'll provide some background for you so you understand my issues... I have created a "template" project with 6 custom timelines. From that project I created multiple new projects - which they all have the 6 custom timelines. These projects are
    all stored in the Project Center. The problem I am having is I don't understand how to select a specific timeline to show on the project specific SharePoint site. They all seem to be displaying 1 of the 6 timelines (in no particular order). I was thinking
    maybe if I had edited a project and saved it while it was displaying a specific timeline it would display the last selected timeline on the SharePoint site, but it doesn't seem to be doing that.
    Is there a way to select a specific timeline to display on the SharePoint site?  Also, is there a way for a user to cycle through the numerous timeline view on the project specific SharePoint site?
    I await your help!! :)

    Michelle_Sm --
    I ran into this problem at the company where I used to work.  One of our PMs had created multiple Timeline views, and wanted a specific custom Timeline view to show up in the Project Site for that project.  I could not see any way to make that
    happen.  We had one of our SharePoint developers look into the issue, and he could not see any way to make this happen either.  So, I am thinking this is not possible to do.  But I would gladly welcome others in this forum to tell us the trick,
    if there is one!  :)  Hope this helps.
    Dale A. Howard [MVP]

  • Auto populate Infopath 2013 fields after selecting a specific dropdown option.

    Auto populate Infopath 2013 fields after selecting a specific dropdown option.
    Hi.
    I have a Sharepoint 2013 list with three fields. Code, Section and Sub Section.
    I would like to be able to have the form autopopulate the Section and Sub Section fields when a value for code is entered.
    How would I go about this please?
    Thanks
    Jon

    Hi JonMorgan,
    Based on your description, my understanding is that you want to achieve that the second dropdown gets populated depending on what the first dropdown is set to.
    To achieve your requirement, creating cascading dropdown fields with InfoPath.
    Please refer to the following links about cascade drop down in InfoPath form:
    http://msreddysharepoint.blogspot.in/2012/12/infopath-2013-web-browser-creating.html
    http://www.pointbeyond.com/2011/11/20/cascading-dropdowns-in-infopath-2010/
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Lisa Chen
    TechNet Community Support

  • How to select a specific XML node with XPath

    Hi,
    I'm trying to a select a specific node from my XML data using the XPath Builder.  For example, say I have a process variable 'xmlData' with the
    following contents:
        User 1
        101
        User 2
        102
    I can successfully use the following expression to retrieve the name of
    a specific user:
    (/process_data/xmlData/users/user[userid='102'])/name
    The problem is I need to use another process variable for the selection
    key.  For Example:
    (/process_data/xmlData/users/user[userid=/process_data/@userId])/name
    But this always returns null.  I've tried surrounding /process_data/@userId
    with single quotes, double quotes, and event {$..$}. 
    Any help would be greatly appreciated.
    Thanks.

    Hi,
    Thanks for the quick replies.  I gave a bit of a bad example, as the
    userid in my data is really a string, not a number.
    A better example is:
        User 1
        user1
        User 2
        user2
    I can get the following to work perfectly:
    (/process_data/xmlData/users/user[userid='user2'])/name
    but I can't get it to work with
    /process_data/@userId = "user2"
    (/process_data/xmlData/users/user[userid=/process_data/@userId])/name
    Thanks.

  • How to remove a dispatcher with a specific index (conf_indx)

    Hi,
    A few details:
    We are on 11.2.0.3 linux 64bit.
    We use both dedicated and shared connection.
    We have many environments (an environment consists of many schemas) in a single DB.
    For each environment we create at least one service (we know # of services is limited to ~150 in 11.2) - in example for environment with suffix LAB1 we create a service called DB_LAB1
    in example:
    exec dbms_service.create_service('DB_LAB1','DB_LAB1');
    exec dbms_service.start_service('DB_LAB1');
    For clients to be able to connect to the service_name using shared mode - we also create a dispatcher per environment - serving that specific service -
    in example:
    alter system set dispatchers='(index=30)(protocol=tcp)(service=DB_LAB1)(dispatchers=1)'
    I have a few environments which I would like to remove - including their services and dispatchers.
    removing the services is easy using dbms_service - however I did not find a way to remove/delete a dispatcher with a specific index.
    Say I have conf_indx 1..50 used and I would like to remove conf_indx=30 (the one which I created above) - how can I do that?
    Stopping the dispatcher process (Dxxx) does not remove the row from v$dispatcher_config - it only shows that the number of dispatchers for that row is 0.
    Bottom line - how to remove a specific dispatcher with a specific dispatcher-index - without affecting all the other dispatchers which I would like to preserve?
    Thanks.
    Mor

    Ok, but how does one remove some of the applications that are appear in the context menu for a given file type? Is there an asc file which can be edited?
    For example, in my system a PDF can be opened with over 10 applications. I would like to see just the three ones I use: Acrobat, Skim and Preview.
    Thanks in advance.

  • Transaction SE16: Field selection (User-Specific Settings) is NOT working for ALL tables

    Hi Guru’s,
    I have an issue in Transaction SE16, Field selection (User-Specific Settings) is NOT working in Tables (ALL tables).
    Following is the screenshot attached for your kind reference,
    That is in the initial screen of transaction SE16 if I choose Filed Name or Filed Label only the technical details (Field Names) are appearing and not the descriptions like Client, Purchasing Doc, and Company Code Doc. Category Document Type etc…
    Right now I am using ECC6 and EHP7 SAP system.
    Please help me to resolve this issue by implementing any OSS note or User Role creations or any technical changes required in system.
    Hope the requirement is clear and in case need any clarification please revert back.
    NOTE: Right now in Development System we don’t have any successful user to compare the settings.
    Regards,
    Kumar.S

    Thanks Patra.
    Even I searched in SAP portal and couldn't able to find the relevant OSS note.
    Following is my BASIS team response,
    "Only you can view Table Field values from higher release"
    Can you suggest / guide on this comment as well.
    Looking forward to your speedy response.
    Regards,
    Kumar.S

  • Select query with index acess

    Hello,
    Please give me some code with using index acess ( please high light the index)

    SELECT carrid connid cityfrom
    FROM spfli INTO (xcarrid, xconnid, xcityfrom)
    WHERE carrid = 'LH ' AND cityfrom = 'FRANKFURT'
    <b>%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'.</b>
    WRITE: / xcarrid, xconnid, xcityfrom.
    ENDSELECT.
    chk this
    Select using Secondary Index
    Message was edited by:
            Chandrasekhar Jagarlamudi

  • WAD 3.5 - Pass a date to Hierarchical Filter Selection Key Date

    I'm working in WAD 3.5, with 3.5 queries.  I currently have a Hierarchical Filter Selection on Org Unit using a query with no Key Date set, so as to pull the most current version of the hierarchy.  This filter selection is then applied to several charts and tables below. 
    I need the web app to initially display this current version, but also allow the user to select a date, which triggers a requery of the Hierarchical Filter Selection data provider, passing the date selection to the key date of the data provider query.  1) how do I pass the date (currently from a drop down) to the key date of the other query, and 2) how do I force a requery of the Hierarchical Filter Selection?
    The problem we are attempting to address is that if Org Unit A contained Org Units 1, 2, and 3 at the end of 2007, but only 1 and 2 today, the Hierarchical Filter Selection will not show #3, thus not allowing the user to drill down to it.  If they can choose the version/point in time of the hierarchy, they will then have the ability to drill down on the older Org Units.
    Thanks!
    Anna
    Edited by: Anna Kamrath on Feb 6, 2009 8:52 AM

    Our solution was to modify the user exit variables and store the values in a MEMORY ID and restore from there.

  • Navigation to specific index in interactive reporting

    In detail Lists, if we want to navigate to a specific index, then how to do.
    Thankyou for your time in giving the answers.
    Bhaskar.

    Hi,
      you can specify that as:
    case sy-lsind.
    when 1.
    when 2.
    when 3.
    .............."for third list.
    endcase.

  • I have selected a specific text tone for a certain contact but I only receive default tone when they text me. Why?

    I have selected a specific text tone for a certain contact but get the default tone when they text me. What am I doing wrong?

    Interestingly the selected text tone plays when texted by another iPhone.

  • When using a numbers spreadsheet, how do I select a specific area for printing?

    When using a numbers spreadsheet, how do I select a specific area for printing?

    Also this would be a question for the Numbers app fourm.  Not the iMac hardware fourm.

  • How to add Solid/Text/Shape at specific index?

    Hello, is there a way to add Solid/Text/Shape at a specific index in a composition? Like for example a composition has 5 layers and I want to add a Solid at index 3 instead of at the beginning of the layers like it does by default. Setting the ID of the Solid after I have added it doesn't work, because its readOnly.

    As far as I know these is no way to change the index while creating a layer.
    Look into <<AE Scripting guide>>.Page.87,There are 4 methods to satisfy your need after the layer is created.
    app.project.item(index).layer(index).moveToBeginning();
    app.project.item(index).layer(index).moveToEnd();
    app.project.item(index).layer(index).moveBefore(targetLayer); //targetLayer is a AVLayer object,so  you should try this way: targetLayer = app.project.activeItem.layer(index);
    app.project.item(index).layer(index).moveAfter(targetLayer);
    I almost forget that ,script can use app.executeCommand(app.findMenuCommandId("Shape Layer")); to add a shape layer just above your selectedLayers. I don't remember,but maybe this feature is supported after AE CS6

Maybe you are looking for