Open zachweix opened 3 months ago
Hey @zachweix Your code works perfectly:
crud.field('features').subfield('quantity').onChange(function(field) {
if (field.value == 0) {
crud.field('features').subfield('value', field.rowNumber).hide();
} else {
crud.field('features').subfield('value', field.rowNumber).show();
}
}).change();
BUT after reordering, the row number stays the same & causes the BUG:
I have assigned my colleague to fix it. Thanks for reporting.
Thank you very much!
Bug report
What I did
I added a rule in a repeatable crud field with a subfield
I then added more rows to the repeatable field and rearranged them.
What I expected to happen
Changing "always_active" shows/hides "when_to_show" on the same row.
What happened
Changing "always_active" shows/hides "when_to_show" on a different row.
What I've already tried to fix it
I've tried tweaking the repeatable blade file, but was unable to find the source of the problem. Essentially, when we are creating the rule, we are binding the specific field being edited to a row number. If instead we either bind a row number edited to a row number or if we bind the field to its neighbor, no matter the row - either option should fix it, I just couldn't think of the best way to do that
Is it a bug in the latest version of Backpack?
After I run
composer update backpack/crud
the bug... is it still there? YesBackpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is:PHP VERSION:
PHP 8.3.2-1+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Jan 20 2024 14:16:40) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.2, Copyright (c) Zend Technologies with Zend OPcache v8.3.2-1+ubuntu22.04.1+deb.sury.org+1, Copyright (c), by Zend Technologies with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans
LARAVEL VERSION:
11.0.7.0
BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.3.0 backpack/crud: 6.7.0 backpack/editable-columns: 3.0.1 backpack/generators: v4.0.4 backpack/pro: 2.1.8 backpack/theme-tabler: 1.2.8