Changing row selection of a af:table component in a managed bean

Hi,
how can ich programmatically change the selected row of a <af:table> component within a managed bean class?
I have a table which depends on the date settings of a <dvt:timeSelector> of a <dvt:lineGraph> component. Now when the timeSelector is moved to new dates the table should be refreshed by executing the query for the table again with the new dates. The problem is when the query of the table's view object is executed again the first row will be automatically selected after executing.
Now I want to achieve that the last row I have selected will be selected again after moving the time selector.
I searched already in the OTN Discussion Forum but didn't find a fitting solution.
Thanks in advance!

The problem is that executing the query moves the current roe to the first one.
What you can do is to save the current row (its pk), execute the query and then set the current row to the pk of the saved selected one. Set the table attribute displayRow="selected" and set the selected row of the table to the now current row.
One problem is that you have to be sure the last selected row is still in the record set of the new query result.
Here are some pointers with code:
Keep the scroll position on partial commit in <af:table>
Jdev 11G ADF BC: rollback and keeping current row problem
How can I programmatically select row to edit in ADF - 11g
Timo

Similar Messages

  • Multiple row selection capability in the table

    Hi
    I have a group with table layout style and I want to set the rowSelection property of the generated table to "multiple" but it seems that there is no way to do that from JHs unless using the group as LOV, which is not desired for me. Here is the code which sets this property in tableGroup.vm :
    #if (! ($JHS.current.group.useAsLov && $JHS.current.group.multiSelect))
    selectionListener="#{#BINDINGS_TABLE().collectionModel.makeCurrent}"
    rowSelection="single"
    #if( ! $JHS.current.group.useAsLov )
    selectedRowKeys="#{#TABLE_BEAN().selectedRow}"
    #end
    #else
    rowSelection="multiple"
    selectedRowKeys="#{#LOV_PAGE_BEAN().selectedRowKeySet}"
    selectionListener="#{#LOV_PAGE_BEAN().selectionListener}"
    #end
    Is there any reason to not allowing to have multiple row selection capability in the table when it is not in LOV mode?
    Thanks
    Ferez

    Ferez,
    No, but if you want to have multiple selection, there is typical a custom action you want to apply to the selected rows, which cannot be defined in the Jheadstart Application Definition editor.
    However, it is perfectly fine to use a custom tableGroup.vm template and enable multi-selection.
    Steven Davelaar,
    JHeadstart team.

  • Dynamically changing row color in an ADF table?

    Hi,
    I am using Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. Can anyone please let me know the code for dynamically changing the row color of an ADF table?
    Thanks,
    Vik

    well you can use EL on af:column inlineStyle property to change the color on condition
    e.g
    inlineStyle='#{(row.SelectedRow)?"background-color: Silver":""};a example can be found here it is changing color based on Checkbox selection http://baigsorcl.blogspot.com/2010/06/deleting-multi-selected-rows-from-adf.html

  • CheckBox in DataGrid - how to check without changing row selection?

    Hi Everyone
    I have a CheckBox set as the renderer/editor for a column in
    my DataGrid
    and I would like users to be able to check and uncheck the
    boxes on
    different rows without selecting or changing the selection of
    the
    current grid row.
    Is this possible? Any help would be very much appreciated.
    Thanks
    Gary Q

    Hey Gary,
    When you are defing the checkbox as itemrenderer then create
    a new class for that and make one checkbox component in that.
    then in the dataprovider of your datagrid append one
    <selected>false</selected> tag. Then in your renderer
    class check for the selected tag like
    override public function set data( value:Object ):void
    super.data = value;
    if(value == null)
    return;
    var xml:XML = XML( data );
    if(xml.selected == "false")
    cbx.selected = false;
    else
    cbx.selected = true;
    private function updateSelected():void
    super.data.selected = cbx.selected;
    [Bindable] public var selected:Boolean;
    <mx:CheckBox id="cbx" width="14"
    click="updateSelected()"/>
    </mx:HBox>

  • How to set ADF table cell value in managed bean

    Hi all,
    I have an ADF table on my page, let's assume with three columns with Input text box: col A, col B and col C where column C is hidden, when I click on Submit is possible to set in managed bean the value of column C for each rows?
    Thk in advance.
    L-

    Hi,
    you can create a button with an ActionListener. In the ActionListener you can iterate over the rows (using the iterator) and set the value on the attribute. If you need to save the changes you can call the commit operation binding.
    Linda

  • How to get ADF UI Component value in managed bean

    JDev version 11.1.1.1.3.0
    I have written a managed bean method and calling that method on valueChangeEvent of a Select boolean Checkbox ADF Component.
    I want to retreive the value of some other component located in the same page as the checkbox. I need the value of the component into the manged bean. I know how to get the value of the checkbox eg:
    public void selectCheckBoxListener(ValueChangeEvent evt){ 
    boolean selectedValue = (Boolean)evt.getNewValue();
    String oldvalue = (String)evt.getOldValue();
    How can I access the value of an input text component in the above managed bean ? Can someone help on this?

    Hi Sackam,
    String selectedRowId = (String)(evt.getComponent().findComponent("rowId")).getAttributes().get("value");
    The above coding will work fine
    but wht u have specified rowId???? whether the "value" field is inside a af:table????? if so i have doubt on the above code's working.....
    Regards,
    Suganth.G

  • How to access backing bean of a xml component , in a managed bean of ADF

    Hi,
    We wrote a xml component in JSF and this component is used in ADF project by including the component as jar .
    In a master detail page , we need to update the value of the xml component, when the master row is changed. How to do this.
    We are trying to do this by accessing the backing bean of the xml component in ADF project's managed bean. So when ever the row changes, we can access the managed bean in ADF and then can set the value of the xml component by accessing it's backing bean
    But i can't access the backing bean instance of the xml component in the ADF managed bean. Could you let me know how to do this. Thanks .

    Thanks for the response Shay. The xml component is added as a custom component , with a separate faces-config.xml file . This component is added to ADF project as a jar with a custom tag.
    In the ADF project , i'm having different managed beans and i can access them from a different managed bean.
    The issue is, i can't access the added custom component's backing bean which is available from a different jar , defined in a separate faces-config.xml file . This backing bean is defined with request scope.

  • Get component Id in managed bean

    Hi experts,
    I am going to ask a foolish question, but since i'm a newbie i hope you'll forgive me .
    I am using JDev version: 11.1.2.3.0. My question is: Is it possible to get a component id inside a managed bean? By components i mean, buttons or menu items. The scenario i would like to create is this:
    I am using JasperReports to generate some required reports. I would like to do something like having a Menu with different items. By clicking each one of them, set a string in the managed bean i'm using to generate the reports (actually the string would be the name of the jrxml file i am going to load). And this string would get it's value based on which menu item is selected.
    Is it possible to do such a thing? Or may be some other way would be more suitable?
    Thank you in advance!

    MenuRenderer  is a class that renders the current value of
      UISelectOne  or  UISelectMany  component as a list of
       menu options and makes use of getId.
    https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCwQFjAA&url=http%3A%2F%2Fjava.net%2Fprojects%2Fmoja…

  • How to call partial trigger on JSFF component from separate managed bean?

    Guys and Gals,
    Using JDev 11.1.1.2.0. Looked on the forums and google. Initial results aren't so great.
    Is it possible to call a PPR on a JSFF component from a separate managed bean? It seems calling the FacesContext in this instance calls the root JSPX, which only contains one child: the RichDocument.
          UIComponent component =
             FacesContext.getCurrentInstance().getViewRoot().findComponent("pc1:table1");
          if (component != null)
             AdfFacesContext context = AdfFacesContext.getCurrentInstance();
             context.addPartialTarget(component);
          System.out.println(FacesContext.getCurrentInstance().getViewRoot().getChildCount());Returns 1 :(
    Ideas for a workaround?
    Edited by: LovettWB on Nov 17, 2010 3:39 AM
    Edited by: LovettWB on Nov 17, 2010 4:11 AM
    Edited by: LovettWB on Nov 17, 2010 4:12 AM

    Thanks! Joonas, you've been a great help.
    The code on the page you referenced was close, but the code on a page referenced in the user comments was even better:
    http://www.jroller.com/mert/entry/how_to_find_a_uicomponent
    My region is located in a facet, which the page you posted doesn't quite cover, but the page above fixed that. Here's the fix below:
    In Managed Bean
          // search for the region ID (or task flow) in the base page
          UIComponent base = jsfUtils.findComponentInRoot("dynamicRegion");
          // now find component ID from within that region
          UIComponent partTable = jsfUtils.findComponent(base, "partTable");
          // call PPR on your found component
          AdfFacesContext.getCurrentInstance().addPartialTarget(partTable);In JSFUtils utility class
       // used to locate region.  Could also find any component
       // located in the base ViewRoot()
       public static UIComponent findComponentInRoot(String id) {
        UIComponent component = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
          UIComponent root = facesContext.getViewRoot();
          component = findComponent(root, id);
        return component;
        // Recursive method which finds your component within JSFF
        // regardless of facet or other UIComponents which may have children
    public static UIComponent findComponent(UIComponent base, String id) {
        if (id.equals(base.getId()))
          return base;
        UIComponent kid = null;
        UIComponent result = null;
        Iterator kids = base.getFacetsAndChildren();
        while (kids.hasNext() && (result == null)) {
          kid = (UIComponent) kids.next();
          if (id.equals(kid.getId())) {
            result = kid;
            break;
          result = findComponent(kid, id);
          if (result != null) {
            break;
        return result;
    }Good stuff to know!

  • How to get the previous row selected index of a table....

    Hi friends,
    I have a table. i have a action/event handler defined on its onLeadSelect event.
    In this event, if i use node_code->get_lead_selection_index( ) .. i m getting the newly clicked row index.
    ex: table has 3 rows.
    Row 1 is by default selected. Now if i select the row 3, in my event by using node_code->get_lead_selection_index( ). im getting index 3. which i sel
    But i want to get index 1. 
    kindly help me.. i dont have any other option as i m very new to this.
    hope i gave u correct inputs on my problem.
    thanks in advance,
    Niraja

    One way to achieve this is to maintain an attribute in the assistance class or a node element , called OldLeadSelection , at the Component controller level which stores the value of the lead selection index.
    On LeadSelect action handler method, in the first line, read the value of the attribute/element defined above. For the first time a row is lead selected, this value will be initial. After exexcuting the code in the LeadSelection event handler method, store the LeadSelection index value in the attribute defined above. The next time when the LeadSelection event method is called, when the value of this attribute is read in the initial line, it will house the value of the index of the previous LeadSelection.
    There could be other ways to achieve this. This is one of the methods.
    Best Regards,
    Rashmi.

  • Capture the rows selected in a multiselect table view (BSP)

    Hi,
    My requirement is:
    I have a table view in which I can select multiple rows.
    I will be selecting some rows, and pressing a button.
    Functionality of button is written in Javascript, to open a popup window.
    But how will I capture which all rows were selected ?
    Should I use a Java code or ABAP code ?
    And where should I put that code ?
    I tried calling the method cl_hrrcf_iterator=>get_tv_attr in the Javascript of the button. But it doesnt work. But if its in DO_HANDLE_DATA it works. Why is it like that ?
    Is it possible in BSP, to use the function htmlbevent.obj.getSelectedRows() ? If so, how should the code be ?
    Could you please tell me some of the possible solutions.
    Would definitely appreciate quick replies.
    Thanks,
    Nisha Vengal.

    Hi Nisha,
    You can have the ABAP code itself. I had also faced with then same issue. Use the below piece of code form your requirements.
    In *IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START*
    *  Data : M_ROW_REF type <Structure type>
    *m_row_ref ?= p_row_data_ref*
    In *IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START*
    * DATA : CHK TYPE FLAG
    *case p_column_key.*
       when ' <Column Name>'.*
         CHK = m_row_ref-><Column Name>.*
          p_replacement_bee = CL_HTMLB_CHECKBOX=>FACTORY(
                                id                = p_cell_id
                              checked         = CHK ).
    In *Do Request*
    Data : loc_table_event type ref to cl_htmlb_event_tableview
    call method cl_hrrcf_iterator=>get_tv_attr
        exporting
          p_tv_id               = '<Tabe View ID'
          p_component_id        = me->component_id
          po_request            = me->request
        importing
          po_tv_event           = loc_table_event.
    The above methods are used to get the values which are selected in the table view and operated further.
    Reward points if useful.
    Regards,
    Gokul.N

  • Retaining row selection in a new  table which uses the same model.

    hi can anybody help me
    actually i have a table which allows multiple selections.like it allows to select row1 & row 4 if
    there are 5 rows.Now on click of a button i show a dialog with another table but with the same model
    applied to it.
    now my problem is that iam not able to make the selction of 1 & 4 rows in the new table.
    if i use a selectSingleRow in a for loop only 4rth row is getting selected.
    if i use a selection interval method it selects all the 4 rows from 1 to 4.
    is there any way i could select only the 1st and the 4rth row ?

    import javax.swing.*;
    import java.awt.*;
    import javax.swing.table.*;
    class Testing
      public void buildGUI()
        JTable table = new JTable(10,3);
        JScrollPane sp = new JScrollPane(table);
        sp.setPreferredSize(new Dimension(300,200));
        JFrame f = new JFrame();
        f.getContentPane().add(sp);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
        table.changeSelection(1,0,true,false);
        table.changeSelection(4,0,true,false);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • Why can't i change row and column height in tables?

    a mind-boggling problem to be sure. For some odd reason, I can't use the inspector to type in row/column heights for tables. I can use the up/down arrows, but those only work in increments of 1. I can manually adjust them one by one but as soon as I edit text in a different table cell, I have to start all over again. Does anyone else have this problem?

    Hi Gerry & Ric
    I had already tried both of your suggestions without any luck but I appreciate the help anyway. I should've been a bit more specific: I can actually type in the column/row height windows, but when I press return or tab, Pages ignores the numbers. I've tried using both the number pad and the regular keyboard numbers and every manner of clicking, enter, tab, control, alt......there must be some setting with my computer that is causing an incompatibility with Pages. Boh!
    Susie

  • Table component disturbing the order of rows while displaying

    HI,
    In jspx when ever data is displayed in table,when we select last page the table component
    is displaying data which is not sorted.(values given to table are changed in output).
    This is occuring only in last page.
    EX:If i have 87 records with pagination,where 15 are displayed.
    when i select to last page the output from my query is not matching the data viewed.
    Using apache trinidad1.0.5
    Regards,
    Vin
    Edited by: vinTK on Apr 26, 2012 6:16 AM

    I think that it's a very common situation.
    No ideas?
    I think that it's interesting to create appz with great performance.

  • How to populate a table based on a row selection from another table.

    Hi, i just started to use ADF BC and Faces. Could some one help me or point me a solution on the following scenario .
    By using a search component , a table is being displayed as a search result. If i select any row in the resulted table , i need to populate an another table at the bottom of the same page from another view. These two tables are related by primary key . May i know how to populate a table based on a row selection from another table. Thanks
    ganesh

    I understand your requirement and the tutorial doesn't talk about Association between the views so that you can create a Master-Detail or in DB parlance, a Parent-Child relationship.
    I will assume that we are dealing with two entities here: Department and Employees where a particular Department has many Employees and hence a Parent-Child relationship.
    Firstly, you need to create an Association between the two Entities - Department and Employees. You can do that by right clicking on the model's entity and then associating the two entities with the appropriate key say, DepartmentId.
    Once you have done that, you need to link the two entities in the View section with this Association that you created. Then go to AppModule and make sure that in the Available View Objects: 'EmployeesView' appears under 'DepartmentView' as "EmployeesView via <link you created>". Shuttle the 'DepartmentView' to the right, Data Model and then shuttle
    "EmployeesView via <link you created>" to the right, Data Model under 'DepartmentView'.
    This will then be reflected in your Data Controls. After that, you simply would have to drag this View into your page as a Master-Detail form...and then when you run this page, any row selected in the Master table, would display the data in the Detail table.
    Also, refer to this link: [Master-Detail|http://baigsorcl.blogspot.com/2010/03/creating-master-detail-form-in-adf.html]
    Hope this helps.

Maybe you are looking for

  • ICal update And creation of a third calendar that I am now locked into

    I had both a work & home calendar set up and sync'ed via M-ME. All seemed to work fine. Now, they are not syncing properly and are behaving in ways I have never seen before. - Push syncing is no longer working. I have tried resetting the sync data wi

  • Is there a way to delete custom presets? (Premiere Elements 11 Mac)

    I have been experimenting with different ouput options for AppleTV with 1080p and 720p video, and have created many custom presets.  I would like to get rid of several which didn't give good results.  I have not found an option to delete custom prese

  • Cascading picklist

    hi i have created one cascading picklist.parent picklist have the predefault value based on country field in User entity.child picklist values based on parent picklist value selection.parent picklist not exposed in UI. The problem is whenever creatin

  • Hi Friends, communicational channal is disappear in RWB

    1) In sender file adaptor we configure the communicational channal and processing mode is Delete, interface is working fine.but  I changed the processing mode is TEST.but its not working and i checked RWB ,its disappear the the communication channal.

  • Need to download pdf converter to new computer

    I need to install PDF Converter to a new computer.  Where do I go for this?