Athento allows, in the list of related documents, to add buttons with custom behavior.
This is done with the datatable functionality to add buttons.
In the case of Athento, the Javascirpt code must be defined in a property called CUSTOM_RELATED_DOCUMENTS_BUTTONS in the athentose/settings_custom/local_settings.py file.
An example configuration would be:
CUSTOM_RELATED_DOCUMENTS_BUTTONS = "['copy', 'excel', 'selectAll', 'selectNone', \
{\
text: 'Validar documento',\
action: function ( e, dt, node, config ) {\
run_operations_on_related_documents([[192,'Validando documento'], [193,'Cambiando estado']]);\
}\
}]"
Where you can see how they are defined:
- The list of usual buttons: 'copy', 'excel', etc.
- The custom button in the same list, which is defined with a "JSON" structure with the parameters "text" and "action". As value for "action" is assigned a function that calls the function run_operations_on_related_documents with a list of tuples. This list of tuples contains as first value the identifier of the operation to execute and as second value a message to show to the user while executing that operation.
In the code above, it is shown in bold what should be parameterized in each case.
Comments
0 comments
Please sign in to leave a comment.