table1.selectRow() not working with Selection mode = Multiple

I've been using a custom JS query which allows user to select all rows in a table, while allowing the users to do multiple selection manually by clicking.

table1.selectRow(_.range(0, table1.displayedData.length-1))
(From this post )

However, recently the custom JS stopped working unless I change the selection mode to single. Is this an expected behaviour or if there are any way to workaround so that I can have the select all functions while allowing the users to do multiple selections manually on a table?

4 Likes

I was just posting on this bug as well.

Using myTable.selectRow() to clear a selection on a multi-select table leaves a single item in selectedRow with a value of undefined:

If I then select some rows selectedRow looks like htis:

image

I also confirmed it only affects multi-select tables. I also tried tblProducts2.selectRow([]) and tblProducts2.selectRow(null) which both have the same effect.

Edit:
Clicking the "Clear Selection" link in the table properly clears the selection.

@terrywong @bradlymathews

Hey there :wave: This is currently a bug we have on our end. I have linked the bug report to this thread and will update you when there is a fix :slightly_smiling_face:

3 Likes

Hey all :wave: This should be resolved now!

1 Like

tested on my end, working again!!
Thanks Team!

This isn't working for me right now :smiling_face_with_tear:

P.S: I have intentionally disabled 'Allow selecting multiple rows', but tried enabling this too, didn't work.


:point_up_2: Query I am running

image
:point_up_2: Updated value

cc: @lauren.gus

Hey @rsubh! This seems to be working for me.

As a note,

If your table allows multiple rows to be selected, then table.selectRow() expects and array to be passed in like:

If your table does not allow multiple rows to be selected, then table.selectRow() expects a single value like:

And just to make sure, selectRow with a multi-selectable table + _.range works for me as well! :slight_smile:

Hello, @victoria selectRow don't work in new table but work perfectly in legacyTable.

Hi @AnsonHwang It should work in the new table if you put the array of rows to select in an object {index: [array_here]} See the docs for the full syntax

That works.
But should the detail docs show in table component page instead of use tutorial, right?
The detail should be showed in the page.

Hi @AnsonHwang! Yes, either that or we should at least link to it. I'll ask the docs team internally :smile: Thanks!

It also looks like we need to update the filter link so I'll check on that as well