Navigate previous record,next record by entering key-up and key-down

Hi ,
JDeveloper11g_
I am trying to solve of how to navigate previous record,next record by entering key-up and key-down in ADF Table.
If any of you have this solution by JScript of Backing Bean please help me.
Thanks
zakir
===

Hi zakir,
I hope I understood your requirements correctly. You have an editable ADF table. You would like to use the up/down arrow keys to move from one row to the next/prev row of the same column. Since the Tab key moves the cursor to the right and Shift+Tab moves it to the left, now you want to implement the same thing but just up and down, correct? If so, try this.
/** Javascript **/
function detectKey(evt) {
    var inputText = evt.getSource();
    var id = inputText.getClientId();
    var start2 = id.indexOf(":") + 1;
    var end2 = id.lastIndexOf(":");
    var numValue = parseInt(id.substring(start2, end2));
    var evt2 = evt.getNativeEvent();
    arrows=((evt2.which)||(evt2.keyCode));
    switch(arrows) {
        // Up arrow
        case 38:
        numValue = numValue - 1;
        break;
        // Down arrow
        case 40:
        numValue = numValue + 1;
        break;
    var newStr = id.replace(/:\d:/, ':' + numValue + ':');
    var comp = AdfPage.PAGE.findComponent(newStr);
    if (comp != undefined) {
        comp.focus();
/** Jspx. (Place a client listener on each inputText in the ADF table) **/
<af:column .....>
  <af:inputText value="#{row.bindings.price.inputValue}" .....>
    <af:clientListener type="keyDown" method="detectKey"/>
  </af:inputText>
</af:column>With this, you get to move Up/Right/Down/Left in the editable ADF table without using the mouse.
References:
http://thepeninsulasedge.com/blog/?cat=29
af:clientListener attributes and methodes of event object in java script
Regards,
Chan Kelwin

Similar Messages

  • Move to previous or next magnified photo     Press Left Arrow and Right Arrow keys does not work

    Move to previous or next magnified photo
    Press Left Arrow and Right Arrow keys
    This command no longer works in iPhoto. The photo just bounces for a moment, then all the photos begin scrolling. I used to be able to just hit the key to scroll one at a time.

    What version of iPhoto and system are you running?  What mode are you in, edit, full view, full screen, ???
    OT

  • Next Item through Enter

    Dear Friends,
    how can i jump to the next item through enter key instead of tab key in apex form??
    Thanks in Advance
    Regards
    Kamran

    Hello Kamran
    Try the following code. I got this from google
    <script type="text/javascript">
        $(document).ready(function(){
              $("input").not( $(":button") ).keypress(function (evt) {
                   if (evt.keyCode == 13) {
                        iname = $(this).val();
                        if (iname !== 'Create'){     //Change it as per the names of your buttons
                             var fields = $(this).parents('form:eq(0),body').find('button,input,textarea,select');
                             var index = fields.index( this );
                             if ( index > -1 && ( index + 1 ) < fields.length ) {
                                  fields.eq( index + 1 ).focus();
                             return false;
    </script> --
    Zulqarnain
    MaxApex Hosting
    http://www.maxapex.com

  • Default button being clicked multiple times when enter key is pressed

    Hello,
    There seems to be a strange difference in how the default button behaves in JRE 1.4.X versus 1.3.X.
    In 1.3.X, when the enter key was pressed, the default button would be "pressed down" when the key was pressed, but wouldn't be fully clicked until the enter key was released. This means that only one event would be fired, even if the enter key was held down for a long time.
    In 1.4.X however, if the enter key is pressed and held for more than a second, then the default button is clicked multiple times until the enter key is released.
    Consider the following code (which is just a dialog with a button on it):
    public class SimpleDialog extends JDialog implements java.awt.event.ActionListener
    private JButton jButton1 = new JButton("button");
    public SimpleDialog()
    this.getContentPane().add(jButton1);
    this.getRootPane().setDefaultButton(jButton1);
    jButton1.addActionListener(this);
    this.pack();
    public void actionPerformed(ActionEvent e)
    if (e.getSource() == jButton1)
    System.out.println("button pressed");
    public static void main(String[] args)
    new SimpleDialog().show();
    When you compile and run this code under 1.3.1, and hold the enter key down for 10 seconds, you will only see one print line statement.
    However, if you compile and run this code under 1.4.1, and then hold the enter key down for 10 seconds, you will see about 100 print line statements.
    Is this a bug in 1.4.X or was this desired functionality (e.g. was it fixing some other bug)?
    Does anyone know how I can make it behave the "old way" (when the default button was only clicked once)?
    Thanks in advance if you have any advice.
    Dave

    Hello all,
    I think I have found a solution. The behaviour of the how the default button is triggered is contained withing the RootPaneUI. So, if I override the default RootPaneUI used by the UIDefaults with my own RootPaneUI, I can define that behaviour for myself.
    Here is my simple dialog with a button and a textfield (when the focus is NOT on the button, and the enter key is pressed, I don't want the actionPerformed method to be called until the enter key is released):
    package focustests;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    public class SimpleDialog extends JDialog implements java.awt.event.ActionListener
    private JButton jButton1 = new JButton("button");
    public SimpleDialog()
    this.getContentPane().add(new JTextField("a text field"), BorderLayout.NORTH);
    this.getContentPane().add(jButton1, BorderLayout.SOUTH);
    this.getRootPane().setDefaultButton(jButton1);
    jButton1.addActionListener(this);
    this.pack();
    public void actionPerformed(ActionEvent e)
    if (e.getSource() == jButton1)
    System.out.println("button pressed");
    public static void main(String[] args)
    javax.swing.UIManager.getDefaults().put("RootPaneUI", "focustests.MyRootPaneUI");
    new SimpleDialog().show();
    and the MyRootPaneUI class controls the behaviour for how the default button is handled:
    package focustests;
    import javax.swing.*;
    * Since we are using the Windows look and feel in our product, we should extend from the
    * Windows laf RootPaneUI
    public class MyRootPaneUI extends com.sun.java.swing.plaf.windows.WindowsRootPaneUI
    private final static MyRootPaneUI myRootPaneUI = new MyRootPaneUI();
    public static javax.swing.plaf.ComponentUI createUI(JComponent c) {
    return myRootPaneUI;
    protected void installKeyboardActions(JRootPane root) {
    super.installKeyboardActions(root);
    InputMap km = SwingUtilities.getUIInputMap(root,
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    if (km == null) {
    km = new javax.swing.plaf.InputMapUIResource();
    SwingUtilities.replaceUIInputMap(root,
    JComponent.WHEN_IN_FOCUSED_WINDOW, km);
    //when the Enter key is pressed (with no modifiers), trigger a "pressed" event
    km.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER,
    0, false), "pressed");
    //when the Enter key is released (with no modifiers), trigger a "release" event
    km.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER,
    0, true), "released");
    ActionMap am = SwingUtilities.getUIActionMap(root);
    if (am == null) {
    am = new javax.swing.plaf.ActionMapUIResource();
    SwingUtilities.replaceUIActionMap(root, am);
    am.put("press", new HoldDefaultButtonAction(root, true));
    am.put("release", new HoldDefaultButtonAction(root, false));
    * This is a copy of the static nested class DefaultAction which was
    * contained in the JRootPane class in Java 1.3.1. Since we are
    * using Java 1.4.1, and we don't like the way the new JRE handles
    * the default button, we will replace it with the old (1.3.1) way of
    * doing things.
    static class HoldDefaultButtonAction extends AbstractAction {
    JRootPane root;
    boolean press;
    HoldDefaultButtonAction(JRootPane root, boolean press) {
    this.root = root;
    this.press = press;
    public void actionPerformed(java.awt.event.ActionEvent e) {
    JButton owner = root.getDefaultButton();
    if (owner != null && SwingUtilities.getRootPane(owner) == root) {
    ButtonModel model = owner.getModel();
    if (press) {
    model.setArmed(true);
    model.setPressed(true);
    } else {
    model.setPressed(false);
    public boolean isEnabled() {
    JButton owner = root.getDefaultButton();
    return (owner != null && owner.getModel().isEnabled());
    This seems to work. Does anyone have any comments on this solution?
    Tjacobs, I still don't see how adding a key listeners or overriding the processKeyEvent method on my button would help. The button won't receive the key event unless the focus is on the button. There is no method "enableEvents(...)" in the AWTEventMulticaster. Perhaps you have some code examples? Thanks anyway for your help.
    Dave

  • Records are getting duplicated on presing enter key in table control

    Hi All,
    I am using table control in module pool program.  The issue is records are getting duplicated on press of enter key.
    I cannot use sy-ucomm enter and do some validation thing in my code. As the record should get update in int_tab(internal table). Otherwise ZSTR_TAB(table control)will be blank after pressing enter key.
    I have gone through all the previous threads on this. Have implemented sol provided in one of threads. Now records are not getting duplicated but the next line is getting disabled. The code to avoid duplication is :
    MODULE read_table_control INPUT.
      data tc-lines type i.
      DESCRIBE TABLE int_tab LINES tc-lines.
      IF tc-lines GE control-current_line.
        MODIFY int_tab FROM zstr_tab INDEX control-current_line.
      ELSE.
        IF gcreate_code = 'CREATE'.
          zstr_tab-zemp_num = gemp_num.
          INSERT zstr_tab INTO int_tab INDEX control-current_line.
        ENDIF.
        IF gchange_code = 'CHANGE'.
          MODIFY int_tab FROM zstr_tab INDEX control-current_line.
        ENDIF.
      ENDIF.
    ENDMODULE.   
    This module is in PAI. Now how to make the lines in control input enabled??
    Any other sol for avoiding duplicate records on pressing enter key?
    Thanks,
    Seema

    Hi,
    Have you written any code in when Others of case...Endcase  ?
    If Yes then checkout if there is anything wrong over there, debug and check.
    If not then write delete adgecent duplicates from Int_tab comparing key fields.
    Also check in PBO, if you have written any query that selects data from particular table and appending the internal table irrespective of entry is already exist. So you should write select query in the if...Endif block as below,
    If int_tab[] is not initial.
    select * from ZSTR_TAB
    into table int_tab
    where .........
    endif.
    If above is not the case then debug and check where exactly entries are getting duplicated so that I can have idea what exactly is happening.
    Regards,
    Umang Mehta

  • Question about going to next or previous record

    Hi there,
    I have a data block which is not based on table. It is a multi record block that gets populated with default values depending on some value on the previous tab. This item called "description" has also a LOV attached to it. The user should have the option of keeping the default values or clicking on LOV to change the value for each record. Each LOV is different and depends on default value.
    Cursor is in last record. I click on LOV the correct lov pops up. click on previous record by just clicking on the record and not using (previous record button from toolbar) and click on LOV, incorrect LOV is shown. It is showing the LOV from the last record.
    But if I click on previous record button, correct LOV gets populated.
    Which trigger should I use to solve this?
    Thanks

    Hi,
    I would use the when-new-record-instance trigger to kick off your logic.
    Where is it called from at present - post-query?
    The previous & next record keys do the same as key-up & key-down but using the mouse forms will not fire this logic for any records passed over. We had a similar problem with validation and had to disable mouse navigation for that form so we could just trap key movement.
    Regards
    Kevin

  • Navigation Problem in Next/Previous Record

    Hi,
    I have a Master (have 20 fields) and Four its Detail block visible on same screen but each block have its own Canvas and Window. Now master table have 1700 records with its detail tables. So after Query when I press the Next_Record button it will no response some time I have to press it twice or thrice then it will respond and some time on fist click it gives the response.
    So I want to navigate through Next Records or Previous Record buttons on single click.??????????
    Kindly send me the solution of this problem on urgently basis.
    Best Regard,

    Hi,
    It's very difficult to suggest something by readingyour post. There are many reasones for navigation problem. Validation is one of them. Be sure that validation triggers written on any level are working properly. What code you have written on the buttons that you are using for navigation. In which blocks you have put your buttons. It is recommended that you put all your non-database items in a non-database block. Check this also.......

  • Is there an easy way to fetch next/previous record in Apex?

    I am new to APEX/Oracle, but have a lot of expierence as a mainframe programmer and some experience with SQL.
    I have been tasked by my boss to create a set of pages in an application as follows.
    Page 1: Select an Employees Name and go to Page 2.
    Page 2: Display Employee's Biography Information.
    Add a "Next Employee" button and a "Previous Employee" button that will fetch the next/previous Employees Biography info respectively.
    In essence, he wants a query with every employee's biography information with the employee selected on page 1 used as the starting pointer.
    I have successfully built "select an Employee's name on page 1" and "display his/her info on page 2" with a query that returns a single record.
    What I can not figure out is how to get a next and previous button to get the next or previous record in a multi record query, using the intially selcted employee as the intial pointer.
    Is their an easy way to build this using built-in APEX functionailty, or will it require programming to achieve this requirement?

    Bob,
    I installed the Aria application, but now I wish I'd run the preview first. It's a cool application, but I don't see anything like what greich requested. I'm looking for the same thing.
    <ol>
    <li>     and clicked the Edit or View Details button for an individual. </li>
    <li>That takes me to a custom Form page that shows one person. </li>
    </ol>
    I'm trying to imagine how I'd code buttons for that Form page to let me click to see the next or previous person on that same form. My mind gets totally boggled when I consider that the user might have filtered the report to only show a few records. How do I have any idea what those IDs were and what order they were showing in, to know which is the next individual.
    My only thought it to create a process on the report that could save primary key (e.g. employee ID) to a table or Apex collection? Then the form button runs a process that finds the current ID then uses next or previous?
    I'm not sure how I could capture the PK in the report in order to save it.
    Does this make sense? Anyone got a better idea?
    Thanks,
    Stew

  • Button that always works when Unde the Enter key to record the information?

    Hello everyone,
    How do Oracle Express, a button that always works when Unde the Enter key to record the information
    and every time I write some information that the cursor is placed back into the Text Field item only on my screen
    order to optimize this process
    I appreciate your cooperation and attention ...
    good day ...
    Reynel Martinez Salazar

    Hi,
    First, you should change your text item to a "Text Field (Always submits page when Enter press)" item. This adds a call to the submitEnter() javascript function which will submit the page when you press Enter while in the text field.
    Second, on your page, edit the Page definition. In there is a setting called "Cursor Focus" - set this to "First Item on Page". When the page is loaded, this will put the cursor into the text field.
    Andy

  • Next - Previous record in ADDT?

    I have an image gallery that displays a dynamic image from a dynamically created thumbnail, which works fine.
    Is there a way to have 2 arrows at either end of the thumbs and move to the next image in the recordset, ie a Previous and Next link? ...just like there is in the pop-up window if you use the dynamic Thumbnail tool - but I don't want it in the pop-up window, but rather in the main window.
    Thanks in advance,
    Mick

    Hi Mick,
    Perhaps you've already found an answer to this question. But I've learned thanks to a tip from Günter Schenk here on these forums, (and with some experimentation on my part), that one can add paging navigation using Dreamweaver's native tools to do as you describe.
    Data tab > Recordset Paging : Recordset Navigation Bar (and sub options)
    Data tab > Display Record Count : Recordset Navigation Status (and sub options)
    I've been using the native Recordset Navigation Bar to compliment ADDT without trouble.
    Regards,
    JTueller

  • Next/previous records

    Hi,
    I am new to Forms 6i and any pointers would be appreciated.
    I have set up a form using a master/child relationship. The
    master block (mfg_date) has only one field (id). I created
    toolbar buttons to step through the master records using the
    following code.
    (Toolbar Button code for previous record)
    GO_BLOCK('mfg_date');
    GO_RECORD(TO_NUMBER(:SYSTEM.CURSOR_RECORD)-1);
    (Toolbar Button code for next record)
    GO_BLOCK('mfg_date');
    GO_RECORD(TO_NUMBER(:SYSTEM.CURSOR_RECORD)+1);
    These buttons work fine by themselves.
    I also created an LOV allowing the user to select any master
    record using the following code.
    (WHEN BUTTON PRESSED Trigger Code for LOV)
    DECLARE
    v_choose BOOLEAN;
    BEGIN
    v_choose := SHOW_LOV('new_mfg_date');
    IF NOT v_choose THEN
    MESSAGE('You have not selected a value.');
    BELL;
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    GO_BLOCK('load_sheet');
    IF :SYSTEM.BLOCK_STATUS ='CHANGED'
    THEN DO_KEY('COMMIT_FORM');
    END IF;
    GO_BLOCK('mfg_date');
    GO_RECORD(TO_NUMBER(:SYSTEM.CURSOR_RECORD));
    END IF;
    END;
    This code also works fine by itself.
    My problem occurs if I use the LOV and then use the
    previous/next record buttons. If I select a record using the LOV
    and then use the buttons, the next/previous records displayed
    are in relation to what was selected with the buttons, not with
    the LOV. For instance: If I use the buttons to step through the
    records up to record 5, and then select record 18 with the LOV
    and then use the buttons again, the record navigation is in
    relation to record 5, not 18.I start through the records with
    the next-record button, the next record displayed is 6 instead
    of 19. Record 18 also seems to become record 5 at this point.
    What I would like is to have the next/previous buttons work in
    relation to the record that is displayed. I have also tried
    up/down, scroll_up/scroll_down, and next_record/previous record
    with the same results. Obviously there is some logic that I&#8217;m
    not grasping yet. Hopefully someone maybe able to point me in
    the right direction.
    Thanks
    Paul Howard
    [email protected]

    Yeahh and don't forget that even google doesn't show you more than 1000 records ;)
    Gints Plivna
    http://www.gplivna.eu
    Message was edited by:
    gintsp

  • Create record by the enter key

    I have a form with 10 items. Looks like this
    P16_ID hidden
    P16_Created_on Date Picker
    P16_Order_No Text Field
    P16_Origin Display as Text(saves state)
    P16_Destination Display as Text(saves state)
    P16_Bill_To_Location Display as Text(save state)
    P16_Rate Text Field
    P16_Code Select List
    P16_Carrier Select List
    P16_Weight Text Field(always submits page when enter pressed)
    I want the people to be able to key in the information and after the weight hit enter and it submits the page. Then it allows you to key in your next loads then when you get to weight hit enter again and so on. I do not want to have to use the create button because that takes longer to key the information in when you have to take your hands off of the keyboard and click create. The problem I keep getting is a branching error and the always submit page when enter pressed don't seem to work. I have version 1.6. Please help

    I believe that APEX submits a page when the enter key is press by default. However, I noticed that when you have a hidden field present in the form you get the branching error message. .
    If you change your hidden fields to regular text fields, this will take care of the problem. Of course, this may not be the best on your form, showing your ID on a regular text field.
    I am not sure if APEX developers intended to have it like this or if this is a bug.
    I hope this helps.

  • Using WHEN-LIST-CHANGED on T-list to navigate block records

    I have a form on which I use a T-List to list all of the child records in a block based on the selected parent record of the form. I am using the T-List almost strictly for navigational purposes (and eventually later for delete purposes as well). Above my T-List on the form is all of the individual fields that display the details of the record that is selected in the T-List. My POST-QUERY trigger on the block populates the T-List with all of the child records, and also uses the value of the highest (max value) child record to updated all of the detail fields for the block. I also have a program unit that updates all of the detail fields for the block that gets called from my WHEN-LIST-CHANGED trigger for the T-List. It passes the key value from the T-List to the program unit and updates all of the child record detail information.
    My problem comes when I attempt to actually update the currently selected child record. I've tried a number of different things to get this to work, but none of them have completely worked, and I'm coming to the end of my knowledge base and can't figure out how to make this update the child record correctly. Initially I was having a problem where the form actually WAS performing the update, but it was always (no matter which list item I had selected) updating the same record, which was the first record that was retrieved for the block. I've run the form in debug mode, and checked the actual values of the child record fields after I've changed the selected item in the list, and all of those fields are actually the correct values corresponding to the selected item in the list, but for some reason, it won't update the record that is currently in those fields when I do a save. From what I can tell, I need to be able to somehow actually navigate the records in that block when I click on an item in the list (i.e. perform next_record or previous record until the block gets to the record that corresponds to the item selected in the list) so that the form recognizes and attempts to update the correct record.
    Has anyone out there tried this before? Does anyone know of a solution for how to do this? Any help would be greatly appreciated. Thanks in advance.
    -::YEX::-
    <)))><

    1. WHEN-LIST-CHANGED trigger is not for items it is for List items (Pop , COMBO, Tlist)
    2. Try to write a code on WHEN-VALIDATE-ITEM at field level with code similar to this
    if :custname is not null then
    begin
          select ship_to_location into :ship_to_location
            from tablename
         where custcd = :custcd;
    exception when no_data_found then
          ----call some alert and error message.........
    end;
    else
      :ship_loc := null;
    end if;plz mark it helpful/correct if it is

  • How compare previous records in runtime, in forms

    Hi
    Please help me in below
    I have a form with columns Country_name,Country_code,Risk_level,Currency(unique) and Bank. and form is having multiple records.
    Here I can enter duplicate values in Country_name,Country_code,Risk_level.
    1) In currency Column, If I give USD it should check previous record of currency column,whether currency column is having a value for particular country. if yes, it should not allow. If now it should allow.
    2) If I give any currency other than ALL, then it should not allow ALL in next record.
    3) If I give ALL in currency column for first record, in next record it should not allow others currencies including ALL for particular country.
    Need help....
    Regards,
    Raghu
    Edited by: 914330 on 13-May-2012 22:25
    Edited by: 914330 on 14-May-2012 01:05

    This would be a fine sample for an analytic function. Look up lead and lag at http://tahiti.oracle.com and build a view upon your table using the analytic functions.
    cheers

  • Updating neighboring records in no key table

    I have Table1 with 3 fileds: Field1, Field2, Field3. There is not key in the table.
    I need to do the following:
    If the Field2 equals 'A', the same field of the next record should be set to 'B'.
    If the Field3 equals 'F', the same field of the previous record should be set to 'E'
    For example:
    Field1 Field2 Field3
    =====  =====  =====
    123     A    D
    124     R    F
    123     N    M
    121     A    F
    123     C    B          Should become
    Field1 Field2 Field3
    =====  =====  =====
    125     A    E
    126     B    F
    123     N    E
    121     A    F
    124     B    B          Please advise on how to do this.
    Thanks.

    A natural order to rows in an Oracle heap table is a complete fallacy. If my table space has 100 blocks and my table starts at block 40 and goes to block 45, then someone drops or truncates a table at block 20, now my table takes an extent and is allocated blocks 20 through 25. Now when I select from the table and Oracle does a full table scan, I am likely to get rows from blocks 20 - 25 before the rows from blocks 40-45. Of course if rows are deleted and more rows inserted, then this too will affect the order in which rows are returned.
    There is no guarantee that Oracle will return rows in the order in which they were inserted.
    So, you need information in the row to tell you the sequence in which to return them.

Maybe you are looking for