Author Topic: SetSelection scrolls the page  (Read 526 times)

stevejacobsen

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
SetSelection scrolls the page
« on: February 22, 2022, 07:22:31 am »
This is a followup on my listeners post. I have a search 'begin' search field and when the search is close enough. Leaving just a few options. I listen for the keydown event and allow the user to scroll the remaining items in the grid.

It leaves the search field and goes to the first row of the grid.

The problem is: it is going to the first row but also scrolls the page up one row. And then does not allow the user to scroll through the rows as before. I thought I could set the focus of the page but that does not help.

Code: [Select]
                            if (evt.keyCode === 40) {
                                $("#inventory_grid").pqGrid("setSelection", {rowIndx: 0, focus: 0});
                            }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: SetSelection scrolls the page
« Reply #1 on: February 22, 2022, 02:46:42 pm »
Please check the following changes:

Code: [Select]
     if (evt.keyCode === 40) {
          $("#inventory_grid").pqGrid("setSelection", {rowIndx: 0});
          evt.preventDefault();
     }