This topic is locked

How to move to beginning of list after setting edit on all records

5/20/2020 6:00:46 PM
PHPRunner General questions
B
bobalston author

In an earlier post I found Javascript code to add to the Onload event that forces all rows into inline edit status.
pageObj.inlineEdit.editAllRecs();
Can someone suggest code that will move the cursor/focus back to the first record of the list?
I am prototyping an after school youth activities attendance list where the names and a checkbox for attendance is used. Subsequent code posts that to each youth's record.
thanks
Bob
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=27434&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' />

Sergey Kornilov admin 5/20/2020

You can try something like this in Javascript OnLoad event. "CustomerID" is here is the name of the first edit field.

$("input[id^=value_CustomerID]").first().focus();
B
bobalston author 5/21/2020



You can try something like this in Javascript OnLoad event. "CustomerID" is here is the name of the first edit field.

$("input[id^=value_CustomerID]").first().focus();



didn't help. Yes I changed the name to the first edit field.

Placed this code right after the other code.
Bob

Sergey Kornilov admin 5/21/2020

It worked in my test but maybe your configuration is different or maybe this code fires too soon. Inline Edit takes a bit of time to load, especially if you have more than a few records on the page.
You can try something like this. The problem is that if loading all records in edit mode takes more than 5 seconds it will not help.

setTimeout(function(){ $("input[id^=value_CustomerID]").first().focus(); }, 5000);


I just wanted to add that most likely in the next version of PHPRunner we'll add an option of Excel-like editing when you can load the list page with all records being editable immediately.

B
bobalston author 5/21/2020



It worked in my test but maybe your configuration is different or maybe this code fires too soon. Inline Edit takes a bit of time to load, especially if you have more than a few records on the page.
You can try something like this. The problem is that if loading all records in edit mode takes more than 5 seconds it will not help.

setTimeout(function(){ $("input[id^=value_CustomerID]").first().focus(); }, 5000);


I just wanted to add that most likely in the next version of PHPRunner we'll add an option of Excel-like editing when you can load the list page with all records being editable immediately.


Unfortunately no joy. I wonder if it has to do that my field I used (replacing CustomerID) is a checkbox?

Bob

Sergey Kornilov admin 5/22/2020

It must be a text field. You cannot focus on a checkbox.

B
bobalston author 5/22/2020



It must be a text field. You cannot focus on a checkbox.


Aha! thanks.
Bob

B
bobalston author 5/23/2020

Could I use code to "move up" in the list in a loop and stop when it errors out?
If so would you provide code please?
Thanks
Bob