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

    get the row index in q-table

    Framework
    2
    7
    2805
    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.
    • E
      eloy.silva last edited by

      get the row index in q-table
      my configuration is:

      <q-table
                    dense
                    :data="dataTable"
                    :pagination.sync="pagination"
                    @request="onRequest"
                    binary-state-sort
                    :columns="columns"
                    row-key="CompanyID"
                    selection="single"
                    :selected.sync="selected"
                    @selection="handlerSelection"
                    separator="horizontal"
                  />
      
      
      
       handlerSelection(details) {
            var self = this;
           
            self.rowIndex = details.keys[0]; // the index is not obtained
      
          },
      

      Thanks in advance

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        Wouldn’t it be CompanyID? So details.CompanyID?

        Scott

        E 1 Reply Last reply Reply Quote 0
        • E
          eloy.silva @s.molinari last edited by eloy.silva

          @s-molinari

          so how can i get the row index in the q-table

          thanks

          1 Reply Last reply Reply Quote 0
          • s.molinari
            s.molinari last edited by

            You can’t. Row index has been taken out.

            Scott

            E 2 Replies Last reply Reply Quote 0
            • E
              eloy.silva @s.molinari last edited by

              @s-molinari

              I used the row index, to eliminate

               self.dataTable.splice(self.rowIndex , 1);
              

              now, my pages no work.

              can you give me some ideas to help me

              Thanks in advance

              1 Reply Last reply Reply Quote 0
              • E
                eloy.silva @s.molinari last edited by eloy.silva

                @s-molinari

                I tried this way and it works, my question is if it is correct or are there other more efficient ways

                 handlerSelection(details) {
                      var self = this;
                     let i = self.dataTable.map(item => item.id).indexOf(details.keys[0])
                     self.rowIndex = i ;
                }
                
                
                1 Reply Last reply Reply Quote 0
                • s.molinari
                  s.molinari last edited by

                  I have no idea. Sorry. If it works, great. But, it should be sending your data row in details and you should be able to work with your own ID to find your data and work with it as you need to. Thing is, the row index will change, if the user reorders or filters (if you have those features in use) the table. That’s why you should work with your own data id field and not the row index of the table.

                  Scott

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