selectedRow shows data vs selectedRows does not show data

Hi

I have a table with multiple selections and a Form to update.

When I use the selectedRow in Form Data source
I use the "form data key" to show the data of the selected row.
The fields in the from is showing data from the table for the last selected row.

When I use the selectedRows in Form Data source
I use the "form data key" to show the data of the selected row.
but the fields is blank and do not show any data even if I only select one row.

I do not know what I'm doing wrong or can you not use "form data key" with selectedRows?

Note that I'm new to reTool and Javascript

-Thore

HI there @Thore,

The reason for that is that with selectedRows you need to select an index. See the state for selectedRow

image

against selectedRows

image

For you to see how it works, try using {{table1.selectedRows[0]}} and you will see it working with your first index of your selected rows.

1 Like

Question to the [0]

will this have any limitation if I run a update query for multiple rows?

Thanks for quick reply to by question.

I'm not sure I understand your question or what you're trying to achieve.

Are you trying to update your table via a form submission and your using the selected row/s as default values?

Why not allowing users to modify the table directly?

In any case, you [0] is just a way of referencing the first index, but you can dynamically select which index should be used, either by using another varialbe or by using [i] which stands for index (although this won't work if using as your form data source, as there is no index to refer in there).

Hi @MiguelOrtiz

I have a list that shows all tasks that is a assigned to user.

When user select a row in the task list.
-User is then presented with a form showing some of the data from the Task list (e.g. Title, summery, status, type, due date etc).

-The form also allow user to register comments, change status, link other Tasks to current Task etc.

In some cases user can will need to multiselect tasks in his Task list and then multi update the e.g. status for multiple tasks or add the same comments to many tasks.

-Thore

Ah I see what you mean.

So here are my thoughts:
1- It will be tricky to show in a form the current value of multiple selected rows, especially if they differ between them. Say status is different, you would be able to show both status using either multitag or joining them on a string. But not the best UI/UX, especially if users selects dozens of rows.
2- If the above is not a problem, then you can in theory make a bulk update of your table by creating (with javascript) a series of arrays using 1) the ids of the selectedRows 2) the information from your table.
3- I think what I would do is separate the functionality for instances when only 1 row is selected (i.e the form) and when more than 1 row is selected (e.g. another, smaller form with status and comments). This second form would not need to have data from the task list, and it would be easier to create the dataSet for your Bulk update query.

Hi

  1. I know it is not optimal. but for the users to work efficient the users need to be able to some times multi select rows.
    I have added a switch so user need to turn on Multiple selection when needed.

In the cases where users multiselect and e.g. "Status" is different I can show "Multiple values" so user know that there are different data that will be updated to one common "Status"

I also need to disable some fields if user multiselect rows from different ticket types.

In the table there are one column called "Type" for now I have only 2 different types. eg. "Production", "Development" each type has there own set of rules.

Any tips to how to check if user select row that will result in 2 or more types?


What I'm trying to do is to build a MVP for a new tool to replace 20+ year old tool we have today.

Next step I need help with is to limit number of selections based on Type. that is in another table.

-Thore

You might also try a List View which can be used for single or multiple row selections and provide data about the selected rows for user updates before processing.

Here's a similar setup for creating new items via API which might have a similar use case for updating your selected rows in a more user friendly way:

The above is a container in the list view component but you should be able to use a Form component instead.

2 Likes