Hi Marc,
We actually use a javascript rule for our material plant extension process. It's 3 fold how we do it. A box needs to be checked, and the rule is on a button. There is also a function the Javascript Code on the "Solutions" tab in composer. Since at times we are deleting multiple rows, within the rule on the button, we also have a function to check if the UI is blocked and if so, repeat the process in 5 seconds. It continues through the table to delete all rows with the "Remove" box checked. I hope this helps at least give you some guidance for how you could make it work for your process.
Javascript Code on Solutions Tab
function deleteRow(xPath, index){
var binding = Utils.formatBindingFromXPath(xPath);
binding = Utils.replaceLastIndex(binding, index);
var rowTag = $j("[data-link='" + binding + "']").parents(".form-block-repeating");
if (renderer) renderer.removeGroupItem(rowTag);
}
Check Box we call "Remove"
Rule on the Button
jQuery.confirm('Are you sure you wish to remove the selected plants? If changes are necessary, click NO. If no changes are necessary, click Yes and the selected rows will be removed.','Inputs Complete',
function() {
for (var i = 0; i < count('/my:myFields/my:BAPI_MATERIAL_PLANT_EXTEND_XML_RULES/my:BAPI_MATERIAL_PLANT_EXTEND_XML_RULES_Input/my:Repeating_Content/my:BP_DeletePERow'); i++){
if($form.getValue('/my:myFields/my:BAPI_MATERIAL_PLANT_EXTEND_XML_RULES/my:BAPI_MATERIAL_PLANT_EXTEND_XML_RULES_Input/my:Repeating_Content['+i+']/my:BP_DeletePERow')=== 'true' || $form.getValue('/my:myFields/my:BAPI_MATERIAL_PLANT_EXTEND_XML_RULES/my:BAPI_MATERIAL_PLANT_EXTEND_XML_RULES_Input/my:Repeating_Content['+i+']/my:BP_DeletePERow')=== true){
deleteRow('/my:myFields/my:BAPI_MATERIAL_PLANT_EXTEND_XML_RULES/my:BAPI_MATERIAL_PLANT_EXTEND_XML_RULES_Input/my:Repeating_Content/my:BP_DeletePERow', i);
}
var tid = setInterval(blockedCode,1000);
function blockedCode() {
var isUIBlocked = jQuery('#SVProcessingOverlay').length > 0;
if (!isUIBlocked){
for (var i = 0; i < count('/my:myFields/my:BAPI_MATERIAL_SO_EXTEND_XML_RULES/my:BAPI_MATERIAL_SO_EXTEND_XML_RULES_Input/my:Repeating_Content/my:BP_DeleteSORow'); i++){
if($form.getValue('/my:myFields/my:BAPI_MATERIAL_SO_EXTEND_XML_RULES/my:BAPI_MATERIAL_SO_EXTEND_XML_RULES_Input/my:Repeating_Content['+i+']/my:BP_DeleteSORow')=== 'true' || $form.getValue('/my:myFields/my:BAPI_MATERIAL_SO_EXTEND_XML_RULES/my:BAPI_MATERIAL_SO_EXTEND_XML_RULES_Input/my:Repeating_Content['+i+']/my:BP_DeleteSORow')=== true){
deleteRow('/my:myFields/my:BAPI_MATERIAL_SO_EXTEND_XML_RULES/my:BAPI_MATERIAL_SO_EXTEND_XML_RULES_Input/my:Repeating_Content/my:BP_DeleteSORow', i);
break;
}
clearInterval(tid);
} }
}}
});
------------------------------
Vanessa Kutasi
Foundation Admin./Application Analyst II
Idexx Operations, Inc.
USA
------------------------------
Original Message:
Sent: 11-13-2023 09:50
From: marcus marcus.obren
Subject: How can I delete a row from a repeating table?
Hello,
I'm trying to figure out how to delete a row from a repeating table using a Javascript function. I can't find a form function to accomplish this. I have tried $form.deleteRow, $form.removeRow, $form.emptyRow and many others, none seem to work. I have also used $form.setdeleteRow but that only enables the delete option from the row, I want to actually delete the row, not just enable the ability to delete the row. Is there a form function to do this?
Thank you,
------------------------------
Marc
marcus.obren
------------------------------