Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Focus first row in listgrid

    Isomorphic,

    Is it possible to focus the first row by default when listgrid gets focus. The listgrid is not editable. I didn't find any method in the API.

    Thanks.

    #2
    Isomorphic,

    Is this possible to achieve?

    Comment


      #3
      You could add a focusChanged handler to the ListGrid which checks for the current selection (via 'getSelectedRecords()') and if nothing is selected already calls 'selectRecord()' to select the first entry in the grid.

      Comment


        #4
        Isomorphic,

        I'm trying to create a navigation functionality from some other component to a list grid without a header. So when I do a key event on the other component i need to take focus to the first record in the listgrid, so that user can select or deselect records with keyboard events only.

        I'm looking for something similar to method: focusFilter() which takes the focus to the filter text box but instead to a record.

        Thanks.

        Comment


          #5
          It sounds like you just need to call listGrid.focus()

          That should automatically put focus into the listGrid body, and arrow keys will allow the user to change selection.
          If you specifically want the first record to be selected as well, call listGrid.focus() then listGrid.selectRecord(...) to select the first record.

          Is that not meeting your requirements somehow (or not working for you)?

          Comment


            #6
            Isomorphic,

            I use listgrid which is attached to a textitem as a SuggestBox. So when user enters the text in textItem, listgrid appears with appropriate records and user can select them.

            I want to provide keyboard navigation so that user navigates from the textitem to the first row of the listGrid by Arrow Down key. But using listgrid.focus() doesn't always go to the first row. It sometimes goes to somewhere in the middle record of the listGrid. This could be probably due to previous selections on the listGrid. What is the way to clear the earlier selected focus on key board navigation.


            Thanks.

            Comment


              #7
              That's why we said to also call selectRecord() (see previous post).

              Comment


                #8
                Hi,

                My requirement is not to select first record but to focus on first record, so that user can further press down arrow key to navigate through the rows.

                thanks.

                Comment


                  #9
                  Yes, the cursor will move the selection.

                  Comment

                  Working...
                  X