I is wrong after table sort

I have a custom column of type button.

The button calls a js function that uses i to determine which row was clicked. But, if you sort the table by clicking a header, the i that is returned is wrong.


  1. Click on button is row 1. i is 0 and tblJobsToInvoice.data[i].job_id returns 595. Correct.
  2. Sort by Job name
  3. Click on button is row 1. i is 0 and tblJobsToInvoice.data[i].job_id returns 595. Incorrrect, row 1 shows job_id of 628.

Using an action button works properly, but it cannot be frozen and it selects the row.

Hey! I'm not sure I understand the situation correctly, can you verify you're working with the following as well?

Action Button

  • Can be frozen
  • Select row on click is optional
  • i corresponds to the row's index in table.data
  • Triggered queries do not have access to currentRow

Custom Buttom Column

  • Can be frozen
  • No setting for disabling row select on click
  • i corresponds to the row's position after sorting
  • Triggered queries have access to currentRow variable

Ahh, I thought I had seen the Select row on click option in the past, I was looking in the wrong place! And thus I also missed the freeze row option. :face_with_spiral_eyes: :raised_hand_with_fingers_splayed: Those both will let me use Action buttons and avoid the bug with i.

The i thing however is still a bug. 'i' does not return the current row after sorting when using a custom column button on a multiselect table. I left out the multiselect part in my original post. Maybe that is the difference? And also the reason I cannot use currentRow.

The behavior of i in custom button queries does seem to be inconsistent :pensive: I'm seeing the current behavior started around 2.87 and that there have been requests for both having it align with the index in the underlying data and having it align with the index of the displayed data. My guess is that you're right and this is a bug - doing some follow-up with the team on it.

With some testing it looks like currentRow is still available for custom button columns if multiselect is enabled. What are you seeing in the debug console if you log currentRow from a JS query triggered by the button?


In my use case I need to select just one row to do an operation on and the button is doing that. If I look at currentRow then I will get all selected rows which breaks my logic. currentRow works just fine in other parts of the app.

I'm able to reproduce that behavior with selectedRow but not currentRow. You mentioned this working in other places in your app as well - does that include other tables that have multi-select enabled? If you recreate a fresh app does it work properly as pictured above?