No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    For navigation, how to get selected row index in q-table

    Framework
    3
    6
    45
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jove4015 last edited by

      Re: get the row index in q-table

      I understand that one should not rely on the row index in order to update or work with data at all. However, my goal is to actually navigate through the q-table using arrow / page keys. I found a great example of how to do that here:

      https://github.com/quasarframework/quasar/pull/6598/commits/06289f5b1a9d27ee5188b9f85cce3177b7bb3cb6

      The problem is, it doesn’t work because computedData isn’t there any more, and there is no suitable replacement for “computedData.rowsNumber”.

      I fully understand and appreciate the desire to encourage better coding practices by prompting developers to work with their rows by ID. However, not allowing one to get the index of the current selected row prevents the developer from providing any such navigational shortcuts. The ID of the row does not help me determine which row is shown before or after it on screen. I specifically want to know about the order in which the rows are displayed and change the current selection to the previous or next row.

      Since I’m using virtual scrolling, I can’t simply move the user through the dom, because (particularly on next row it seems) the elements are rerendered and thereafter the element I scrolled into view is no longer there, or is assigned to a different row.

      If quasar has decided it’s too dangerous to allow us to provide this navigational feature to our users, perhaps you could add keyboard navigation as a feature of the table so that we have no need to implement it ourselves? Or perhaps just put the row index back in so this example can work and let developers sink or swim with their own decisions?

      dobbel 1 Reply Last reply Reply Quote -1
      • dobbel
        dobbel @jove4015 last edited by

        @jove4015

        I would posting this dilemma you face with selected row index in q-table on Quasar’s Github has more chance on being heard.

        1 Reply Last reply Reply Quote 0
        • J
          jove4015 last edited by

          Alrighty, sure thing.

          1 Reply Last reply Reply Quote 0
          • J
            jove4015 last edited by

            Posted to github:

            https://github.com/quasarframework/quasar/issues/8542

            metalsadman 1 Reply Last reply Reply Quote 0
            • metalsadman
              metalsadman @jove4015 last edited by metalsadman

              @jove4015 create your own index ie. this.data = rows.map((v,i)=>({...v, index:i})). https://forum.quasar-framework.org/topic/4723/quasar-v1-4-4-released?_=1614301132930

              1 Reply Last reply Reply Quote 0
              • J
                jove4015 last edited by

                That index doesn’t help me - when someone sorts the data in a different direction or types into the search box to add a filter, the “data” array stays the same but the order of rows changes. I need the current row index in the UI, not the data set.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post