Fix delete functionality for vendor notes dynamic rows
- Changed row ID prefix from 'row_' to '_' for valid CSS selectors - Added _id property assignment in row data for proper rendering - Resolves querySelectorAll SyntaxError when deleting rows The issue was that numeric row IDs (0, 1, 2) created invalid CSS selectors like 'tr#0 button.action-delete'. CSS IDs cannot start with numbers. By prefixing with underscore, we get valid selectors like 'tr#_0 button.action-delete'. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -50,10 +50,13 @@ class VendorMapping extends AbstractFieldArray
|
||||
$result = [];
|
||||
/** @var DataObject $row */
|
||||
foreach (parent::getArrayRows() as $key => $row) {
|
||||
// Ensure row IDs are prefixed with a non-numeric character
|
||||
// Ensure row IDs are prefixed with underscore to make valid CSS selectors
|
||||
// CSS IDs cannot start with a number
|
||||
if (is_numeric($key)) {
|
||||
$key = 'row_' . $key;
|
||||
$key = '_' . $key;
|
||||
}
|
||||
// Also set the _id property in the row data for proper rendering
|
||||
$row->setData('_id', $key);
|
||||
$result[$key] = $row;
|
||||
}
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user