Go To Top of Table

After I have deleted a record, I would like to move the focus to the top of the table.

I have checked the docs and cannot find anything on this.

How do I do this?

Mike

Hello,

The table component has a function called selectRow that you can use the move the focus.
image

Thank you for your reply. I have a situation where I need to do a sum on the column CHECK. The value of CHECK can only be 1 or 0 so the idea is to clear for processing if the sum of CHECK = 1.
I have tried to modify your code to get this to work but I have not been successful. If you could help with this, I would really appreciate it.
Mike

Hello,

The selectRow function has two parameters: rowIndex & scrollToRow:

  • rowIndex is 0 based index
  • scrollToRow is not 0 based index

Keep those to point in mind.
Table component has two way to display rows: pagination & scroll.
image

The video below show the code works in both display methods.
row change

The code is

// scrolling to top of table
// Params: `rowIndex` of 0 and `scrollToRow` of 1
table1.selectRow(0,1);

Hope that clears it up.

Just so I understand this properly, I take it that I would write:
table1.selectRow(1)
Do I have that right?
Mike

If you just need the table to go back to the first row (focus to the top of the table), then you just need to use this line below.

table1.selectRow(0,1);

change table1 to your table's ID.

Thank you so much for this.
I tried it and it works.
Thanks again.
Mike

1 Like