Compare commits

..

1 Commits

Author SHA1 Message Date
Taber
d4bc6f8562 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>
2025-11-10 12:58:58 -05:00

View File

@@ -50,10 +50,13 @@ class VendorMapping extends AbstractFieldArray
$result = []; $result = [];
/** @var DataObject $row */ /** @var DataObject $row */
foreach (parent::getArrayRows() as $key => $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)) { 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; $result[$key] = $row;
} }
return $result; return $result;