User tests: Successful: Unsuccessful:
Pull Request for Issue #45994 .
Add subform-order-changed
event when order is changed in subform.
Apply patch.
Run npm install
.
Add subform somewhere, example in Custom HTML module parameters:
<field type="subform" name="subform" label="Subform" multiple="true">
<form>
<field type="text" name="text" label="Text"/>
</form>
</field>
Add in to index.php of Atum template:
$wa->addInlineScript('
document.addEventListener("subform-order-changed", function(event) {
console.log("fromPosition: " + event.detail.fromPosition, "toPosition: " + event.detail.toPosition);
});
', [], ['type' => 'module']);
Open the form with sbform, open browser console.
Try sort the rows in subform, and check console output.
Console is silent
In console a message like "fromPosition: 0, toPosition: 1"
Please select:
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript Repository NPM Change |
I have tested this item ✅ successfully on 08a3f52
I found the instructions difficult. As this is a single JavaScript file change the rebuild should be npm run build:js
. I used a new instance of Modules: Articles to test as there are already two subforms there. I created two instances of the Test text and moved them up/down. In the Console I needed to select the Logs item to see the message (I am not too familiar with the Console). Got there in the end!
I will rebase to 6.1 when it will be in sync