sfRemoveGroupItems
Removes a row at the mentioned index from a group control.
Syntax
sfRemoveGroupItems(id, index, callback)
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
id | string | yes | Control id of the group control. |
index | number | yes | Index of the row in the group control. The index is a zero-based index. |
callback | function | no | Code block to be executed after the row has been removed from the group control. See callback function. |
Usage examples
Example 1
Let us consider a group control Products. To remove the row at the second position (at index 1),
sfRemoveGroupItems('control_products', 1);
Example 2
Let us consider a group control Products and a readonly numeric field NumberOfProducts outside the group control that displays the total number of products in the group control. To remove the row at the second position (at index 1) and update the total displayed,
sfRemoveGroupItems('control_products', 1, function(){
var count = sfGetValue('control_numberofproducts');
sfSetValue('control_numberofproducts', count - 1);
});