UI Builder button click handler question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2023 06:03 PM
I have a page where I'm rendering some JSON data as a table-like setup, through a repeater. The data points are Part ID and Model. Right now I'm including "index", to identify the row, and "dirty" to indicate if it has unsaved changes and so on. I want to allow the user to edit one row at a time, so I have the repeater include an Edit button.
[
{
"part_id": "12345",
"model_sys_id": "78fc30a7db0fc0104815a4f6d49619f1",
"index": 1,
"name": "CNU244BFZ3 - HP EliteBook 8470p",
"edit_mode": false,
"dirty": false
}, ...]
If the user clicks the button for the first row, index 1, I want to update that object to set edit_mode to true, and use this to hide the other Edit buttons and so on.
I figure the way to do this will be to set a client state param, like edit_index, and have my Inputs and buttons and so on enable, disable or hide based on a match between that and @item.value.index. But I've not been able to figure out what gets passed to the handler for the Edit button's click event. Is it aware of the index for its row, and if so where is this value exposed to the handler? I looked all over the event.payload and api objects and found nothing that can tell me what index the user just clicked on.