Refresh a partial within a Backend List via Handler

Hello,

got a short question:

Does the “data-request-update” attribute work in the backend if I would like to refresh a partial within a backend list? I call this handler within the partial:
<a data-request="onSelectOtherName" data-request-data="checked[]:<?= $record->id; ?>,key:<?= $key ?>" data-request-update="names: '@.names'">

Whenever I do this via a custom handler, the $record variable is unknown in the end and I didnt find a proper way to send the data to this partial.

So the only good way to refresh the partial was to add return $this->listRefresh(); in the end of the handler. But since I dont need to refresh the whole list it seems a bit over the top.

Are there better ways?

Yes, you can use data-request-update and also return from the handler:

return [
    '@.names' => $this->makePartial('names')
];
1 Like