I have a table displayed on a screen. When a user clicks on a row in the table, I just want to pass the clicked row data to my OnClick event. I've set an input parameter for the OnClick event as InProcessTasks.List.Current (also tried InProcessTasks.List.Current.Tasks).
In my OnClick event, for the purposes of testing, I am just displaying a message to show the task title I clicked on. Eventually, I want to create a popup or modal to edit the row record but for now I just want to make sure I can get the row data. However, when a row is clicked it always displays the first record's title.
Can anyone please help with retrieving the row in the table that a user clicked? I tried the solutions mentioned below but get the same behavior as above.
https://www.outsystems.com/forums/discussion/67119/how-to-get-data-from-selected-row/
Aah ok,
the reason is you have an event on the whole table, that doesn't work, you have to have an event inside a given row to be able to connect it to the data of that row.
Unfortunately, as you said, you don't have a place on the table widget to connect events to rows.
So if you don't want to use a link or button, you are stuck with putting that event on every row cell, as you had already concluded.
I think not having the option to define events at row level is a missing feature on the table widget, I made a forge component that you can use to fill that gap. Check it out for curiosity, but frankly, for just having it on one single table, you'd be faster done just putting the event on each table cell, I think.
Dorine
I ended up just putting the on click event on each cell. not the end of the world I was just trying to be efficient.
thank you Dorine
i would like to point out one last time, you have marked your own 'I ended up ...' reply as the solution, that is not the intention of the 'mark as solution' button.
Hi @Troy Davidson ,
can you share an oml here, so we can have a look at what exactly you are doing.
The way you describe, it really should work.
Dependant on the exact event, it should even work without having to pass anything into the event.
Another thing that is often used, is just passing in the currentRowNumber, and then in the event logic access the List[clickedCurrentRowNumber]..... instead of the List.Current......, so indexing into the list yourself, instead of using the 'Current' pointer.
Attached my OML.
The screen is viewtasks and the table is ActiveTasks. It is the first table shown on that screen.
Hello
This is because when you pass the value it takes the current value. of the current index, which is the first value showing on your aggregateYou can call a client action on your table and pass the current record or you can pass the current row number and use that as an index to fetch the value from the aggregate by simply passing it on your screen action like this
GetCustomers.List[CurrentRowNumber].Customer.FirstNameI am attaching a sample hope that will help
https://personal-ejuytnht.outsystemscloud.com/SampleForumPOCS/CurrentrowSelected?_ts=638253333578972122
ThanksTousif Khan
Hi Tousif,
I took a look at your OML. This does work on your button click. But I don't have a button in my table, I don't have any room for it. So I'd have to setup Onclick event for each column (not a big deal but not ideal) or shove a button into the row. Is the button the only way to get the current row?
I did setup my onclick event the same as yours but without the button (Event attached to the table) and it still retrieves the top record.