Run crm4.py
once more, and in the Customize List menu, add an item that applies to all entities (and hence is marked as '*') as follows:
If we now open, for example, the list of contacts, we see a new button with a trashcan icon:
The customization we added consists of some HTML to define a <button>
element and some JavaScript to render it as a nice trashcan button and to act on a click:
Chapter10/customizationexample4.html
<button class="delete">delete</button>
<script>
$("button.delete").click(function(){
var url = $("form").last().attr('action')+'/delete';
$("tr.selected").each(function(i){
var id=$(this).attr('id');
$.get(url,{'id':id});
});
$("input[name=cacheid]").remove();
$("button[name=first]").click();
false;
}).button({icons: { primary: "ui-icon-trash" },text: false});
</script>
The click handler fetches the action
attribute from the last form in the list of entities (highlighted...