JavaScript CookBook/Overview List/Deleting items from an overview list

From GeoMedia Smart Client
Jump to: navigation, search

How can I delete an item from an Overview List?

If you want to delete items from an overview list, you have to specify a row action in your formsettings.xml. GMSC 2013

  <FormAction name="Action" action="SCRIPT[IG.remove({confirmMessage:'Do you really want to delete the display rule?',controller:'Feature', action:'DeleteDisplayRule', id:{FORM.Id}, urlParams:{displayRuleId:{ROW.ID}}, reloadFields:['DISPLAYRULEGRID']})]" visible="list" type="row" />

Let's examine the parameters of this lengthy action:

IG.remove({
    confirmMessage: 'Do you really want to delete the display rule?', //this confirm message is displayed in a dialog before the item gets deleted
    controller: 'Feature',  //the controller responsible for the deletion
    action: 'DeleteDisplayRule', //the delete action
    id: {
        FORM.Id   //this statement is replaced with the actual form id when the form gets rendered
    },
    urlParams: {   //this dictionary gets transmitted as GET-Parameters with the request
        displayRuleId: {
            ROW.ID  //ROW.ID is replaced with the actual id of each row
        }
    },
    reloadFields: ['DISPLAYRULEGRID'] //reloadFields is a reload action that gets performed AFTER the item has been deleted. In this case the grid containing the items is reloaded, so that the deleted item gets removed from the grid
});

Other Recipes in this category: