Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)

Cursor Focus on Table row

Hi,

We have a requirement like cursor focus moves to next row after scanning the first row in table. Let me explain in detail, We are using Table which is of 6 empty rows where user can provide some document using scanner. Assume that document number has length 13, after providing document in first empty row in a table the cursor should automatically moves to second table row.

We did some R&D on this but we are not getting any result. Here actually we are using Table instead of Simple Form to display empty rows.

Please find the attached document for the screen shots.

Would is please let us know the possible ways to accomplish this requirement.

Thanks & Regards,
Haritha.  
xlsx

Hi Haritha,

I think you could solve in this way:
you could insert a control on the liveChange of the field, in this way you could check the length of the input and when the input text reaches the desired length, you move to next row with this code:


var v_find= false;

for (var index = 0; !v_find && index < $('input').length; index++) {

try{

   var input = $('input')[index].id.split("-inner")[0];

   if (input == current_field_id) {

         $('input')[index].blur();

         $('input')[index + 1].focus();

         v_find = true;

  }

 } catch(e){}

}


Have a nice day

Alessia

Hi Alessia,


I tried the below in a demo application. But I am not able achieve the issue. Index is not incrementing after 1 with the below code . Please have a look into screen shot for better understanding.


Would you please let us know if I need to do any correction.

image


Regards,

Haritha.

Hi Haritha,

try changing $(inoTableFLD) with $('input') (is a jquery instruction) and assigns to the variable current_field_id the oEvent.getParameters().id value.


Best Regards 
Alessia

Hi,


I used the solution proposed by Ole-André that worked well some time ago in this post :


http://support.neptune-software.com/support/discussions/topics/4000322249


Another approach if your application is not offline is to use the liveChange event as proposed by Alessia and if the length of 13 is reached, you sollicit the backend to add a new line (from data of the first line) into your table. Of course the data of first line has to be cleared from ABAP side and the focus will be still on this first line after Ajax response.


Your first row is editable to add new rows that will not be editable (a deletion mode can be added to your table). It's easy solution as all the logic is in ABAP side not JS but once again not suitable if your application is offline.


Best regards.



PEB





2 people like this

Thanks Alessia & Thanks PEB.


We tried the solution proposed by Ole-André withe some modifications according the requirement.


Once again thanks a lot for the responses.


Regards,

Haritha.  

Login or Signup to post a comment