[DevExpress Support Team: CLONED FROM T518215: AuditTrail - How to show the change history for the current object in a separate form instead of a nested ListView]
how to add to audit list view export and print preview action buttons ?
How to log Export and Print Preview Actions by the Audit Trail module
Answers approved by DevExpress Support
Hello Sławomir,
Consider the following implementation plan:
- Locate and access required Controllers and their Actions:
Concepts > Extend Functionality > Built-in Controllers and Actions
Concepts > Extend Functionality > Customize Controllers and Actions
2. Handle the Action's Execute or ActionBase > ExecuteCompleted events. - Create custom audit items: Concepts > Extra Modules > Audit Trail Module Overview > Customize the Audit Trail System (Add Custom Data to the Audit Log)
Let me know once you have had an opportunity to research and test these solutions in your project.
My solution idea was to handle the events of the ExportController > ExportAction object and then log custom audit entries. Please attach a sample showing your implementation attempts and describe your current difficulties so that we can assist you further.
i have controller with popupaction
where I want display audit records for current object::
C#private void popupWindowAuditKlienci_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
{
ListView lv = Application.CreateListView(Application.CreateObjectSpace(typeof(AuditDataItemPersistent)), typeof(AuditDataItemPersistent), true);
GroupOperator criteria = new GroupOperator(GroupOperatorType.And);
criteria.Operands.Add(new BinaryOperator("AuditedObject.TargetType", ((XPObjectSpace)ObjectSpace).Session.GetObjectType(View.CurrentObject)));
criteria.Operands.Add(new BinaryOperator("AuditedObject.TargetKey", XPWeakReference.KeyToString(ObjectSpace.GetKeyValue(View.CurrentObject))));
lv.CollectionSource.Criteria["ByTargetObject"] = criteria;
e.View = lv;
}
…and when I run this I get list f audit entries, but I can't export this list to excel or pdf like on standard listView
Thank you for removing the ambiguity from your question, because originally I thought that the problem is to get the Export and Print Preview Actions to be logged in the same Audit Trail log.
I've answered your UI customization question separately: How to display the Export and other Actions in a popup ListView